Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.