且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将输入文本值传递给ajax调用

更新时间:2022-05-09 00:04:43

您需要获取数据:{'ntid':$('#Eid')。val()},超出报价。

编辑看一下这里,您问题中的代码正确尝试发送ajax请求。

EDIT Take a look here, the code that's in your question properly attempts to send an ajax request.

编辑2 在这里:

$.ajax({
    type: "POST",
    url: "Testing.aspx/SendMessage",
    data: { ntid: $('#Eid').val()}, // Notice the lack of quotes
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(result) {
        console.log(result.d);
        resultData = eval("(" + result.d + ")");
        //$("#rawResponse").html(result.d);
    },
    error: function(result) {
        alert("jQuery Error:" + result.statusText);
    }
});