weixin_33705053 2015-10-12 03:34 采纳率: 0%
浏览 24

Ajax Post发送空变量

I am trying to send a variable through an ajax post statement as shown below.

var variable1 = "";
var variable2 ="tree";
$.ajax
{
    url: webServiceURL + "AddTask",
    type: "POST",
    data: { ID: variable1 , Value: variable2 }
})

When this is run for some reason the ajax request is dropping variable1 as if it doesn't exist. I was hoping there would be a way to force the call to send variable1's data as "". I can make changes to the back end and send null instead of "" but would really rather not have to do that as it will make things a bit more messy.

  • 写回答

1条回答 默认 最新

  • csdnceshi62 2015-10-12 04:36
    关注

    As adeneo mentioned it was to do with my backend. I have had to instead send data back as null and then have this changed to an empty string.

    评论

报告相同问题?