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
https://forums.phpfreaks.com/topic/71009-passing-variables-from-php-to-ajax/
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.

 

 

 

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.