kirill578 Posted February 16, 2011 Share Posted February 16, 2011 Is it possible to make JavaScript get output our of php page? for instance: i want to insert this page something.php?name=jack into var data Quote Link to comment Share on other sites More sharing options...
trq Posted February 17, 2011 Share Posted February 17, 2011 Pretty simple using jQuery. var data = ''; $.ajax({ url: 'something.php?name=jack', success: function(html) { data = html; } }); Quote Link to comment Share on other sites More sharing options...
jcanker Posted February 18, 2011 Share Posted February 18, 2011 In short, what you're talking about is what AJAX is: Asynchronous Javascript and XML. While it originally took XML from (usually) php output and worked with it on the javascript side, the term AJAX incorporates all types of returned data, including html, text, JSON, and JSONP. What was used in the above example was jQuery, a javascript framework that makes a lot of javascript, but especially AJAX pathetically easy to write and work with. I was fumbling all over trying to learn javascript in order to do AJAX, but jQuery got me up and writing code practically overnight. 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.