JQuery AJAX syntax

前端 未结 9 1880
旧时难觅i
旧时难觅i 2021-01-17 20:11

I am trying to find the correct syntax to pass a varible to my JQuery Post.

var id = empid;

$.ajax({
    type: \"POST\",
    url: \"../Webservices/EmployeeS         


        
9条回答
  •  滥情空心
    2021-01-17 20:57

    if you want to send a JSON string to the server

    data: "{empid: " + empid + "}"
    

    if you want to send querystring params (?empid=123)

    data: {empid : empid}
    

提交回复
热议问题