Siphon Posted July 19, 2007 Share Posted July 19, 2007 Ok here's the deal... I have two pages: index.php, and bag.php. index.php calls for data that is generated by bag.php, HOWEVER, I want the data retrieved from bag.php to be stored in a JavaScript array that is to be able to be used by index.php. I have tried multiple ways to fix this but it doesnt seem to work. To sum up: I want to be able to make a JavaScript array in bag.php, that I can still use in index.php after the request has been made by index.php. Quote Link to comment https://forums.phpfreaks.com/topic/60817-ajax-help/ Share on other sites More sharing options...
RichardRotterdam Posted July 19, 2007 Share Posted July 19, 2007 Sounds interesting have you tried making the bag.php file generate script to pass on? for example bag.php <script> jsArray=new Array(); <?php $phpArray[0]="zero"; $phpArray[1]="one"; $phpArray[2]="two"; $phpArray[3]="three"; for($i=0;$i<sizeof($phpArray);$i++) { echo("jsArray[".$i."]=".$phpArray[$i]); } ?> <script> Quote Link to comment https://forums.phpfreaks.com/topic/60817-ajax-help/#findComment-302893 Share on other sites More sharing options...
Siphon Posted July 20, 2007 Author Share Posted July 20, 2007 Yes I have tried that, the problem is that I can't get the array back to index.php. Itworks perfectly fine to populate the JS-array in bag.php, but it doesn't seem to follow back to index.php upon the AJAX request from index.php. But it doesn't matter, I removed AJAX completely from the page and found a much easier way to do it. Quote Link to comment https://forums.phpfreaks.com/topic/60817-ajax-help/#findComment-303181 Share on other sites More sharing options...
sayedsohail Posted July 20, 2007 Share Posted July 20, 2007 yes with ajax you have limitations, either you to explode it before submitting to ajax and than capsulate the return info. this is the only way i know. best of luck. Quote Link to comment https://forums.phpfreaks.com/topic/60817-ajax-help/#findComment-303259 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.