Hi all,
I am using CakePHP 1.26 and CDN JQuery in this URL: http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
In a HTML web page, I have these lines of code:
$.ajax({
type: "POST",
url: "http://mywebsite.com/controllers/avail/"+curl,
success: function(data) {
alert(data);}
});
and in the PHP page, I got another few lines of code:
function avail($uname){
$result1=$this->Site1->User->findByusername($uname);
if($result1){
return 1;
}
else{
return 0;
}
}
As you see, the Avail function will return either zero or one.
But there was some redundant data returned from the server,
what I saw in the Alert box was somthing like this (rather than 0 or 1):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>my site</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style type="text/css">
/* CSS Document */
/*PAGE LAYOUT*/
0
No, it's not the missing Controller that caused the problem.