ALASKASTREETMASTER
asked on
xajax not using variable
Hi,,
I have something wierd going on with xajax. In the code below, the variables in the $myhtml variable all show up in the response script alert('$myhtml') when sent to the javascript so I know all the values are being retrieved from my query. The thing i dont undestand is that the only two variables that can be added to the script are $row and $taxid. If I add any of the other variables such as sub = $sub; the response does not get back and nothing happens. I take them out and it works. I tried a second response object and it does not work with any other variables either whether i use either or both of the response objects. As long as the response object is exactly $objResponse->script("row= $row;taxid = $taxid;alert('$myhtml');") ; it works. I need to transfer more than just the two variables. Is there a limit in the response?
Any ideas?
Thanks
I have something wierd going on with xajax. In the code below, the variables in the $myhtml variable all show up in the response script alert('$myhtml') when sent to the javascript so I know all the values are being retrieved from my query. The thing i dont undestand is that the only two variables that can be added to the script are $row and $taxid. If I add any of the other variables such as sub = $sub; the response does not get back and nothing happens. I take them out and it works. I tried a second response object and it does not work with any other variables either whether i use either or both of the response objects. As long as the response object is exactly $objResponse->script("row=
Any ideas?
Thanks
$myhtml = " Count: ". $row . " Taxid: ". $taxid . " Legal: " . $sub . " " . $blk . " " . $lot . " Owner: ".$fname . " " . $lname;
$objResponse = new xajaxResponse();
$objResponse->script("row=$row;taxid = $taxid;alert('$myhtml');");
$objResponse->script("sub = $sub;blk = $blk;alert('$myhtml');");
return $objResponse;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How would you encode this variable to include line breaks? I have tried <br>, \n, \r\n.
$myhtml = " Count: ". $row . " Taxid: ". $taxid . "\r\n Legal: " . $sub . " " . $blk . " " . $lot . " \r\nOwner: ".$fname . " " . $lname;
$objResponse->script("aler t(myhtml = '$myhtml';")
Thanks.
$myhtml = " Count: ". $row . " Taxid: ". $taxid . "\r\n Legal: " . $sub . " " . $blk . " " . $lot . " \r\nOwner: ".$fname . " " . $lname;
$objResponse->script("aler
Thanks.
You must double the backslashes, because they are consumed first by PHP, then by javascript in the browser.
$myhtml = " Count: ". $row . " Taxid: ". $taxid . "\\r\\n Legal: " . $sub . " " . $blk . " " . $lot . " \\r\\nOwner: ".$fname . " " . $lname;
$objResponse->script("aler t('$myhtml ');");
$myhtml = " Count: ". $row . " Taxid: ". $taxid . "\\r\\n Legal: " . $sub . " " . $blk . " " . $lot . " \\r\\nOwner: ".$fname . " " . $lname;
$objResponse->script("aler
ASKER
not working see new post please..
ASKER