开发者

How can I post data in cross-domain with an iframe and JQuery

I am wor开发者_StackOverflow中文版king with JQuery, I have got below code sample for JQuery:

$.ajax({  
        type:"GET",        
        url: "Login.aspx",  // Send the login info to this page
        data: str, 
        dataType: "jsonp", 
        timeout: 200000,
        jsonp:"skywardDetails",
        success: function(result)
        { 
             // Show 'Submit' Button
            $('#loginButton').show();

            // Hide Gif Spinning Rotator
            $('#ajaxloading').hide();  
         } 

    });

The above code works fine, however due to "GET", some data gets visible when it requested, I tried using "POST", but in my previous post all the experts refused that we can't use "POST", can anybody suggest how can have the security, I suppose we can do something with "IFRAME", please suggest if we have got some examples using IFRAME.


One method is to open a page of the distant site in an invisible iframe, and then that page opens a page of the local site in an inner iframe, and the outermost and the innermost iframe can communicate freely. I don't see why you would need it though, a POST AJAX call is just as visible as a GET AJAX call.


The answer to your previous post is correct. You cannot load a remote *.js file through the POST protocol with a <script> tag, the same that you cannot use <img> to post a picture.

If you need to authenticate with a remote site, your only chance is using good old forms.


Have you read about Fragement Identifier method http://softwareas.com/cross-domain-communication-with-iframes The post descibes about cross domain communication with iframes using changing fragement identifiers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜