2012-02-28 68 views
1

我有這樣的功能;JQuery回發不起作用

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

我只想工作的網址。當url'll工作,用戶撥打電話。我正確地獲取網址。但$ .post(url);不起作用。你如何解決這個問題?

+0

什麼是你期待發生什麼? – 2012-02-28 08:41:44

+0

我想打開該網址,但用戶一定不能看到該網址。 – ozkank 2012-02-28 08:48:41

回答

2

將成功處理程序傳遞給$ .post方法以執行回調。

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

你需要URL編碼使用encodeURIComponent函數

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

你需要寫的 「成功」

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