1

I have some code on a main page (index.php) that calls a php script (access.php) with javascript, as seen below. The php (access.php) also has javascript but when I load it into the current page (index.php) then the javascript content in (access.php) is not working. Maybe this can't be done. Any thoughts?

The javascript does fire when I load access.php in a browser by itself.

$.post("access.php",
              {FullName : response.name,ID: response.id,Email:response.email,UD:userDevice},

          function(data) 
          {
           document.getElementById('Container').innerHTML = data;
         });

Perhaps I should have stated this before but it's using the Facebook Java SDK. MY END GOAL: I want to SEND VARS to a php that also has more/new Facebook-Java script that I can run from within the index.php.

Papa De Beau
  • 3,744
  • 18
  • 79
  • 137
  • Dynamically loaded Javascript is loaded, but not executed. Check out this one - http://stackoverflow.com/questions/75943/how-do-you-execute-a-dynamically-loaded-javascript-block – Dan Goodspeed Feb 25 '15 at 06:03
  • it's not tagged as jQuery but I can see you are using jQuery so please look at `load` method. http://api.jquery.com/load/ – lujcon Feb 25 '15 at 06:03
  • What kind of javascript would you like to run on the access.php site? – Jesper Feb 25 '15 at 06:03
  • Actually I have complicated matters. The access file actually adds an "include with php". It loads a mobile site or a desktop site. Both sites have jquery in it that I wish to execute. – Papa De Beau Feb 25 '15 at 06:17

1 Answers1

0

This method worked. :)

$( "#Container" ).load( "access.php", 
{FullName : response.name,ID: response.id,
Email:response.email,UD:userDevice} );
Papa De Beau
  • 3,744
  • 18
  • 79
  • 137