JQuery回发不起作用

时间:2012-02-28 08:39:44

标签: javascript asp.net c#-4.0

我有这样的功能;

    <script type="text/javascript">            
        function callUrl(url) {       
            $.post(url);
            alert('You'll redirect a telephone');
        }        
    </script>

我只想工作网址。当网址工作时,用户拨打电话。我正确得到了网址。但$ .post(网址);不起作用。你是怎么解决的?

3 个答案:

答案 0 :(得分:2)

将成功处理程序传递给$ .post方法以执行回调。

$.post(url, function(data) {
   // Call the phone here
});

答案 1 :(得分:0)

你需要编码url使用encodeURIComponent函数

<script type="text/javascript">            
        function callUrl(url) {       
            $.post(encodeURIComponent(url));
            alert('You\'ll redirect a telephone');
        }        
    </script>

答案 2 :(得分:0)

你需要写“成功”

 $.ajax({
  url: "test.html",
  success: function(){
  alert("");
  }
});