2、ajax
1)跨域
$.ajax({
type : "get",
data : "data_xName=" + data_xName ,
url : "http://222.73.x.x/qing/11.php",
dataType : "jsonp",
// jsonp: 'jsoncallback',
success : function(data)
{
alert(data);
}
});
<?php
header('Access-Control-Allow-Origin:*');
$aa="aaa";
//echo $_REQUEST['callback'] . '(' .$aa. ')';
//echo $_REQUEST['callback'] . '("testfsfsdf")';
echo $_REQUEST['callback'] . '(' .json_encode($aa). ')';
?>
2)不跨域
$.ajax({
type : "get",
data : "data_xName=" + data_xName ,
url : "/test/",
success : function(data)
{
alert(data);
}
});
def test_version(request):
name = request.GET.get('data_xName')
return HttpResponse(name)