2011-05-27 138 views
0

我有位於硬盤上的html頁面(在瀏覽器中:file:/// C:/index.html)。我想打開這個html頁面時從aspx頁面加載一些數據。 ASPX頁面被部署在網絡服務器(如http://servername/json.aspx)並返回JSON數據:如何使用jquery ajax從脫機html調用aspx頁面

Response.ContentType = "application/json"; 
Response.Write(jsonString); 

我已經嘗試了很多jQuery的電話的組合,但不sucesfully。

基本上我想要實現這樣的事情:

<script type="text/javascript"> 
$().ready(function()  
{ 
    $("#myButt").click(function() 
    {   
     $.ajax({ 
      type: "GET", 
      url: "http://servername/json.aspx", 
      data: "id=1", 
      success: function(msg){ 
      alert(msg); 
      },   
     });        
    }); 
}); 
</script> 

有人可以幫助我如何實現這一目標? 謝謝。

回答

相關問題