ajax用法

  • Post author:
  • Post category:其他





$

.

get

(

“url”

, {

name:


“John”

,

time:


“2pm”

},

function

(

data

){

console

.

log

(

data

);
});


$

.

post

(

“url”

, {

name:


“John”

,

time:


“2pm”

},

function

(

data

){

console

.

log

(

data

);
});


$

.

ajax

({

type:


“GET”

,

url:


“url/id/”

+

Id

,

dataType:


“json”

,

success


:


function

(

data

){

console

.

log

(

data

);
}
});




$

.

ajax

({

type:


“POST”

,

url:


“url”

,
data:

“name=John&location=Boston”

,

dataType:


“json”

,

success


:


function

(

data

){

console

.

log

(

data

);
}
});

后端直接用$_GET或$_POST接受就行



版权声明:本文为sinat_34440034原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。