Jump to content

Passing variables from php to ajax


jaymc

Recommended Posts

Lets say I use AJAX to call a php script..

 

the php script will return 3 values, variables if you like

 

 

The time

The date

unix time stamp

 

How do I then pass that information back to AJAX as variables so I can use each seperate value

 

At the moment I only know how to pass the entire contents of the php back, rather than say

 

var time=TIME_FROM_PHP_script

var time=DATE_FROM_PHP_script

var time=UNIXTIMESTAMP_FROM_PHP_script

 

Cheers

Link to comment
Share on other sites

If I understand the problem (and ajax/php) correctly...I don't think you can.

 

You can pass variables from the 'current page' to AJAX (and then forward those variables onto another php page)

But the return results from the other php page are written directly to the targetted div and not returned to the javascript.

 

d.

 

 

 

Link to comment
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.