English 中文(简体)
Jquery公司
原标题:Loading Gist raw file from Jquery

我把我可以想象的、但出于某种原因的一切联系在一起。 如果我试图通过ja子或用ancy子或它赢得的 something子装上ist子。 该公司在浏览器中进行罚款。 任何想法?

<a class="raw-file" href="https://gist.github.com/raw/2408789/2da6f8b2377cdb86ac0b7a005eec1c1b90459569/Jquery-click-prevent-redirect.txt">Jquery-click-prevent-redirect.txt</a>
<div>results here...</div>

$(document).ready(function() {
    $("a").click(function(event){
            jQuery.ajax({
               url: $(this).attr( href ),
               dataType: "json",
               beforeSend: function(){
                   $(this).closest( div ).html( getting file... );
               },
               success: function(data) {
                    $(this).closest( div ).html(data);
               },
               complete: function(){
                   //stuff here
               }
          });
    });
});

<<>strong>full demo here:>

rel=“nofollow>http://jsfiddle.net/aseabridge/5jfBm/2/

问题回答

如果你试图从浏览器中做这件事,那么你很可能被Same-Origin政策所阻止。 阅读:

基本上,除非你使用像JSONP这样的东西,否则你可以提出跨地点的要求。





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签