fareedreg Posted December 22, 2009 Share Posted December 22, 2009 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 https://forums.phpfreaks.com/topic/186083-ajax-help-new/ Share on other sites More sharing options...
Adam Posted December 24, 2009 Share Posted December 24, 2009 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 https://forums.phpfreaks.com/topic/186083-ajax-help-new/#findComment-983670 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.