sarris Posted March 10, 2007 Share Posted March 10, 2007 Hi there...I was checking the example explained at http://www.w3schools.com/php/php_ajax_database.aspI was just wondering if there is a way to make the php script return an array of values, to the calling javascript function so that the javascript function can make further processing with that data...Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted March 11, 2007 Share Posted March 11, 2007 You can't return an array object, you would need to return it as a string and use Javascript to split up the string into an array. So in PHP you would use implode to join an array into a string, like this: $array_str = implode("**||**", $array); That will convert the array into a string with "**||**" separating each array element. Then you get the string in Javascript and use split to change it back to an array: var str = new String(return_data);var arr = str.split("**||**"); Link to comment Share on other sites More sharing options...
sarris Posted March 11, 2007 Author Share Posted March 11, 2007 Ok.will try that and see if i got it well. thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now