Manoj Singh
Manoj Singh

Reputation: 7707

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

I am working 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.

Upvotes: 0

Views: 2268

Answers (3)

Tgr
Tgr

Reputation: 28200

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.

Upvotes: 1

sushil bharwani
sushil bharwani

Reputation: 30187

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.

Upvotes: 0

Álvaro González
Álvaro González

Reputation: 146460

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.

Upvotes: 0

Related Questions