奇怪的问题;单击按钮,Jquery使用ASMX

时间:2009-11-11 01:57:51

标签: asp.net jquery ajax web-services asmx

我有一个非常令人沮丧的问题,我肯定是TRIVIAL。每当我在点击功能中移动这个jQuery帖子时,它有时会起作用,但大部分时间都没有。 如果我把它移到外面就可以工作和发布,并且每次都会给出类似的反应..

:: boggled ::有人请赐教。

         $(document).ready(function() {
         $('#Button1').click(function() {

        //alert(document.getElementById('TextBox1').value);
        $.ajax({
            type: "POST",
            url: "sudoku.asmx/getSolution",
            data: "{'pid':'34367'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                alert("succes " + msg.d);
            },
            error: function(msg) {
                alert("fail " + msg.d);
            }
         });
        });
    }); 

1 个答案:

答案 0 :(得分:2)

看起来你需要让你的点击事件返回false。

$("#Button1").click(function()
{
    $.ajax(...);

    return false;
});