Jump to content

ajax getting js function


es131245

Recommended Posts

here is the situation Im loading a content of a page using ajax.Content looks like... <script>...</script>Page content... after loading page content js can't find a function that ive loaded by ajax.Ive planed to use body part js on each page. Doing Solutions from google like:1 <script id="traLaLa"></script> document.getElementById('traLaLa').src='/source/EveryPageJsCode.js';2 eval('<script> Every Page JS here...

Link to comment
Share on other sites

The browser doesn't automatically execute Javascript code that is part of HTML that was later added to the page using something like innerHTML. The best way may be to return a JSON structure which has an HTML section and a Javascript section, and you can add the HTML on the page where it goes and then use eval to execute the Javascript part.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...