Jump to content

AJAX HELP NEW


fareedreg

Recommended Posts

follow this belwo mentioned url ... in this topic you pass a string and get back upper case string. If i want uppercase and reverse of string ... then how can we get back values of two variable seperately. I just want to know that If I have more than  one value getting back... how its possible..

 

 

http://www.ajaxf1.com/tutorial/ajax-php.html?page=3

Link to comment
Share on other sites

You could return an array encoded using PHP's json_encode. The "httpObject.responseText" property would then contain the JSON encoded array that you can access easily with JavaScript. For example:

 

if (isset($_GET['inputText'])
{
    $return = array(
        strtoupper($_GET['inputText']),
        strrev($_GET['inputText']) // I assume this is what you meant by 'reverse of string'?
    );
    echo json_encode($return);
}

 

(...)

var response = httpObject.responseText;

alert('Uppercase: ' + response[0] + ' Reversed: ' + response[1]);

 

Not tested but the logic's right.

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.