thisisnuts123 Posted November 3, 2007 Share Posted November 3, 2007 does any one know how to return 2 value from php function using sajax? function siteinfo() { $one = "one"; $two = "two"; return $one; return $two; } thw above only return one to sajax Quote Link to comment https://forums.phpfreaks.com/topic/75880-solved-sajax-php-help/ Share on other sites More sharing options...
rajivgonsalves Posted November 3, 2007 Share Posted November 3, 2007 the code will return one and exit the function, maybe you can return them as comma seperated values return $one.",".$two; Quote Link to comment https://forums.phpfreaks.com/topic/75880-solved-sajax-php-help/#findComment-384048 Share on other sites More sharing options...
thisisnuts123 Posted November 3, 2007 Author Share Posted November 3, 2007 it works but on the javascript side now i get one,two in one variable.. so jsvar = one,two any other way of doing this? or any way to cut this in to 2 variables Quote Link to comment https://forums.phpfreaks.com/topic/75880-solved-sajax-php-help/#findComment-384051 Share on other sites More sharing options...
rajivgonsalves Posted November 3, 2007 Share Posted November 3, 2007 try this jsvar = returnVar.split(","); this will turn jsvar into an array Quote Link to comment https://forums.phpfreaks.com/topic/75880-solved-sajax-php-help/#findComment-384054 Share on other sites More sharing options...
JasonLewis Posted November 3, 2007 Share Posted November 3, 2007 you could use split. jsvar.split(','); i think thats javascript, lol.. a bit rusty. Quote Link to comment https://forums.phpfreaks.com/topic/75880-solved-sajax-php-help/#findComment-384056 Share on other sites More sharing options...
thisisnuts123 Posted November 3, 2007 Author Share Posted November 3, 2007 got it!!! thanks u are theman.. jsut have to split and pass it on to an array Quote Link to comment https://forums.phpfreaks.com/topic/75880-solved-sajax-php-help/#findComment-384058 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.