2013-03-21 64 views
1

這不是加載頁面錯誤在哪裏? ,這是使用jQuery 1.9.1版本, http://localhost/ReportsSec/MapNavigation.aspx包含谷歌地圖API 下面給出的錯誤頁面:jQuery加載方法不起作用

刷新頁面以查看已打開F12工具之前可能已發生的消息。 SCRIPT5009:使用 'google' 未定義 Default.aspx的,線116字符1 SCRIPT257:無法完成由於錯誤80020101. 的jquery-1.9.1.js操作,線路602字符4

<!DOCTYPE html> 
     <html> 
    <head> 
    <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script> 

    <script> 
     $(document).ready(function() { 
      $("button").click(function() { 
       $("#div1").load("http://localhost/ReportsSec/MapNavigation.aspx"); 
      }); 
     }); 
    </script> 
    </head> 
    <body> 

    <div id="div1" style="width:450px;height:450px"></div> 
    <button>Get External Content</button> 

    </body> 
    </html> 
+2

您使用的是什麼瀏覽器:Cross-domain requests with JQuery

然後,你可以這樣做?使用瀏覽器開發人員工具查看正在發生的事情。例如在控制檯中,您可以看到possbile Javascript錯誤。 – Esailija 2013-03-21 16:49:28

+0

即9,請注意我試圖加載.aspx頁面,沒有錯誤在控制檯 – user2153650 2013-03-21 16:51:06

+0

做任何其他方法的工作? – btevfik 2013-03-21 16:51:29

回答

1

我認爲這個問題可能是你需要一個Ajax國防部爲了加載外部網頁使用jQuery​​的問題。試試這個: $('html').load('http://google.com');

+0

它在控制檯中給出錯誤,,,,,,,刷新頁面看看在F12工具打開之前可能發生的消息 SCRIPT5009:'google'未定義 Default.aspx,line 116 character 1 SCRIPT257:由於錯誤80020101而無法完成操作。 jquery-1.9.1.js,第602行字符4 – user2153650 2013-03-21 17:18:33

+0

YEAH得到它的跨域請求,非常感謝 – user2153650 2013-03-21 17:19:49

+0

Great =)!祝你好運ect^_ ^ – 2013-03-21 17:22:45

0

我覺得這是你的js進口這file.Try一次

<script src="http://code.jquery.com/jquery-1.9.1.js"></script> 


    $(document).ready(function() { 

      $("#div1").load("http://localhost/ReportsSec/MapNavigation.aspx"); 

    }); 
+0

你已經回答,然後向OP詢問問題,沒有任何澄清。 – 2013-03-21 16:52:53

+0

我相信這是問題所在。 – PSR 2013-03-21 16:53:39

+0

即使我猜也一樣。好的好運 – 2013-03-21 16:54:15