ds111 Posted June 9, 2009 Share Posted June 9, 2009 Hello, I am developing an application that heavily uses jQuery. Although I'm really good with PHP, I'm completely new to jQuery. So i found the $("#id").load("http://url....."); function. I also use the jquery ajax form plugin.So basically, this is whats going. The HTML: <div id="results"></div> ...an html form... The JS: $(document).ready(function() { $("#result").load("http://www.url.com/test.php) }); The PHP: echo '<script>alert("Test");</script>'; I know the JS works because if i put alert() infront of it, it works. So how come the PHP code doesnt load and the JS code go into the div "results"? Thanks! Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted June 10, 2009 Share Posted June 10, 2009 Do you want this alert when the ajax is call is completed? If thats what you want look into the oncomplete or onsuccess events for the ajax functionality in the jQuery documentation. Echoing out javascript in the php file thats being called using ajax is usually something you want to avoid Quote Link to comment Share on other sites More sharing options...
Stooney Posted June 10, 2009 Share Posted June 10, 2009 Your div's ID is 'results' and in your javascript you're using 'result'. If that was only a typo when making the post, post you're javascript code that is being echoed. Use code tags this time though edit: you're also missing a double quote on your load() function Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.