-1
$(document).ready(function () 
{

    $("#Result").click(function () {
        $.ajax({
            type: "POST",
            url: "AjaxJquery.aspx/GetDate",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                alert(msg.d);
            }
        });
    });
}); 

我还有另一种方法作为 GetName,如何对其进行编码以调用两个或更多方法,如上面

4

1 回答 1

2

success在函数中调用第二个,而不是alert(msg.d);

$.ajax({
        type: "POST",
        url: "AjaxJquery.aspx/GetDate",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            alert(msg.d);
            $.ajax({
                    type: "POST",
                    url: "AjaxJquery.aspx/GetDate1",
                    data: "{}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (msg) {
                        alert(msg.d);

                    }
    });
    }
});
于 2013-06-25T09:35:49.017 回答