Troubleshooting jQuery AJAX call using Generic Handler in ASP.NET

后端 未结 3 1455
你的背包
你的背包 2021-01-06 14:21

What is the best method to troubleshooting a jQuery AJAX call with ASP.NET? The error function is getting called--I get the alert to popup that says \"Error\", but I don\'t

3条回答
  •  独厮守ぢ
    2021-01-06 15:18

    I tried putting in a return false to prevent a full page postback, but that didn't seem to work.

    If the main problem is that clicking the button control causes a full post back instead of an asynchronous call to your handler, you can add this code anywhere inside your jQuery click event handler:

    jQuery("#<%=BtnUCSSearch.ClientID %>").click(function(e) {
        // Existing code
        e.preventDefault();
    })
    

    This works rather than return false to stop the browser's normal behavior for the button click.

提交回复
热议问题