Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 无法在Jquery的单击事件中设置href_Asp.net_Javascript_Jquery - Fatal编程技术网

Asp.net 无法在Jquery的单击事件中设置href

Asp.net 无法在Jquery的单击事件中设置href,asp.net,javascript,jquery,Asp.net,Javascript,Jquery,您好,我正在尝试在RadioButtonList的click事件中使用Jquery设置href,但如果我将相同的代码用于document.ready事件,则该设置不起作用。它可以正常工作,但在click事件中不起作用。请给我一些建议 $(document).ready(function() { url = "Results.aspx?latitude=" +latitude + "&Longitude=" + longitude; $("a[href='http://w

您好,我正在尝试在RadioButtonList的click事件中使用Jquery设置href,但如果我将相同的代码用于document.ready事件,则该设置不起作用。它可以正常工作,但在click事件中不起作用。请给我一些建议

$(document).ready(function() {    
   url = "Results.aspx?latitude=" +latitude + "&Longitude=" + longitude;

 $("a[href='http://www.google.com/']").attr("href", url); // this works..
        }        
        $('.rbl input').click(function() {

            id = $(this).parent().children("input").val();
            url = "Results.aspx?latitude=" + latitude + "&Longitude=" + longitude + "&ServiceCenterProductTypeId=" + id;
            //alert(url);
            $("a[href='http://www.google.com/']").attr("href", url); //this doesnt work....

        });
    });

在我看来,这一行后面有一个额外的右括号
}

$("a[href='http://www.google.com/']").attr("href", url); // this works..
您(可能)将
AutoPostBack
属性设置为true,从而导致向服务器回发,从而重新加载整个页面


因此,Javascript中的更改将被回发覆盖。

经度和纬度设置在哪里?