views:

28

answers:

1

I'd like to customize the "indeed.com" jobroll in my page which usually appears as so:

<script type="text/javascript"><!--
indeed_jobroll_format = "120x600";
indeed_jobroll_publisher = "19051066";
indeed_jobroll_keywords = "";
indeed_jobroll_location = "";
//--></script>
<script type="text/javascript" src="http://jobroll.indeed.com/ads/jobroll2.js"&gt;
</script>
<noscript><a href="http://www.indeed.com/"&gt;Jobs&lt;/a&gt; by Indeed</noscript>

what I'd like to do is modify the indeed_jobroll_keywords var dynamically based on user actions. So I tried concatenating all that code into one string, for example:

var code = "<script type='text/javascript'><!-- indeed_jobroll_format = '120x600'; ...
... 
"indeed_jobroll_keywords = '" + keywords + ...

and then load this into the page with

$(#identifier).html(code)

and when I do this Firefox appears to refresh the page on the same URL of the page it was on but nothing ever shows.

Could someone please explain why this happens, why this doesn't work, and another way to do this?

A: 

When you refresh the page all JS are reset to the initial state so your changes doesn't have any effect on the scripts behavior. If you want to pass a variable between pages client side you should use cookies to store those values.

RaYell