Jump to content

AJAX Help


Siphon

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/60817-ajax-help/
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/60817-ajax-help/#findComment-302893
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/60817-ajax-help/#findComment-303181
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.