Hi there guys having some problems with a script
I have some tab fields that load a html url
I need to get the parameters of that url in the html that i loaded
<div id="tabs">
<ul>
<li><a href="hosts/timeline.html?ip=${ipValue}">Timeline</a></li>
</ul>
this is my timeline.html file content
<script id="timelineTmpl" type="text/x-jquery-tmpl">
{{each response}}
<li><b>${time}</b><br />
{{each items}}
${icon}: <em>${text}. </em> <br />
{{/each}}
{{/each}}
</li>
</script>
<ul id="timeline"></ul>
<script type="text/javascript" charset="utf-8">
function getURLParam(urlSearch, param) {
p = urlSearch.split(/[&?]/);
p = _.reject(p, function(e) { return e == "" });
p = _.map(p, function(e) { return e.split("=")});
p = _.reduce(p, function(memo, a) {memo[a[0]] = a[1]; return memo; }, {});
return p[param]
}
var request = $.ajax({
type: 'GET',
url: 'ajax/hosts/timeline.xsp?ip='+getURLParam(location.search, "ip"),
dataType: 'json'
});
request.done(function(data){
$("#timelineTmpl").tmpl(data).appendTo("#timeline");
});
request.fail(function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
console.log(textStatus)
});
Now that function getURLParam returns undefined
how can I get it to retrieve that ip vale that i have passed
Ok, Could it be the way that I request the timeline.html ?