Changing the problem of Ajax returning functions:
File: wkl_ajax.js
ExampleCode:
<! 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 >
< Meta HTTP-equiv = "Content-Type" Content = "Text/html; charsets = UTF-8" />
< Title > Untitled document </ Title >
< Script SRC = "Jquery. Min. js" Language = "JavaScript" Type = "Text/JavaScript" >
</ Script >
< Script SRC = "Wkl_ajax.js" Language = "JavaScript" Type = "Text/JavaScript" >
</ Script >
< Script Type = "Text/JavaScript" >
Function Load ()
{
_ Ape_json _. Search ( " Http: // localhost/ME. php " , " COM = 13 " , Function (Meed ){
Alert (meed. Just + " 12... " );
});
/*
_ Ape_json _. Search ("http: // localhost/ME. php", {company: "nihao"}, function (meed ){
Alert (meed. Just + "12 ...");
});
_ Ape_json _. Search ("http: // localhost/test. php", {company: "nihao"}, function (meed ){
Alert (meed. Just + "12 ...");
});
*/
}
</ Script >
</ Head >
< Body Onload = "Load ()" >
< Div Class = "Me" > Test </ Div >
</ Body >
</ Html >
Test. php
<? PHP
Switch ( $ _ Server [ " Request_method " ])
{
Case " Get " :
$ The_request = & $ _ Get ;
Break ;
Case " Post " :
$ The_request = & $ _ Post ;
Break ;
}
If ( Isset ( $ The_request [ ' Random_str ' ])
{
Echo " _ Ape_json _. Back & _ ape_json _. Back ({just: \ "fuckof \", random_str: " ;
Echo ( $ The_request [ ' Random_str ' ]);
Echo " }) " ;
}
// Echo "_ ape_json _. Back & _ ape_json _. Back ({just: \" Fu \ "})" + $ the_request;
?>
Me. php
<? PHP
Switch ( $ _ Server [ " Request_method " ])
{
Case " Get " :
$ The_request = & $ _ Get ;
Break ;
Case " Post " :
$ The_request = & $ _ Post ;
Break ;
}
If ( Isset ( $ The_request [ ' Random_str ' ])
{
Echo " _ Ape_json _. Back & _ ape_json _. Back ({just: \ "Fu \", random_str: " ;
Echo ( $ The_request [ ' Random_str ' ]);
Echo " }) " ;
}
// Echo "_ ape_json _. Back & _ ape_json _. Back ({just: \" Fu \ "})" + $ the_request;
?>
Wkl_ajax.js
End