I have a little problem. I want to pass two variables from PHP to $.ajax success function
I have this code written in JS:
$.ajax({ type:"POST", url:path, data: "value="+info, success:function(data,data1) { if(data==1) { $(id).css("backgroundColor","green"); $(id).attr("readonly","readonly"); $(image).attr("src",data1); } else { $(id).css("backgroundColor","red"); } } });
And my PHP code is :
if(isset($_POST['value']) and !empty($_POST['value'])) { $result=0; $image="src/photo1.jpg"; $value=trim($_POST['value']); if($value=="Abracadabra" or strcmp($value,"Abracadabra")==0) { $result=1; $image="src/abracadabra.jpg"; } else { $result=0; $image="src/photo1.jpg"; } echo $result; echo $image; }
There, I want to "echo" two variables simultaneously to pass to $.ajax success function.
It is possible ? I don't refer to JSON, I refer only PHP with POST method.
Thank you