AJAX call to/from another server

Discussion in 'JavaScript' started by 3dom, Jan 19, 2008.

  1. #1
    Situation is:

    1) page load ajax script file from another site/domain;

    2) user fill up form on the page and submit it via POST/AJAX to another server.

    How to bypass "non secure transaction" message then submitting form to another domain?

    Really annoying thing: ajax cannot work normally with absolute URLs even on same 2nd level domain with and without www. subdomain.
     
    3dom, Jan 19, 2008 IP
  2. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You want to so a cross-site ajax request?
     
    MMJ, Jan 19, 2008 IP
  3. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #3
    For security reasons, you can't post cross-site. This is to stop people stealing other sites' user cookies and such. The only way would be to have PHP relay your request to the host.
     
    jayshah, Jan 19, 2008 IP
  4. 3dom

    3dom Peon

    Messages:
    304
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    1) various widgets use cross-server data requests;

    2) heard something about JSON requests/files/data - but not sure how do they work.

    Any advice where to find good JSON tutorials? Couldn't find comprehensive one.
     
    3dom, Jan 20, 2008 IP
  5. 2mk_atspace

    2mk_atspace Well-Known Member

    Messages:
    317
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #5
    2mk_atspace, Jan 21, 2008 IP
  6. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yeah, because technically it isn't cross-site.

    @3dom: can you expand on your post?

    JSON is just like an associative array, it is very simple, not much to learn. http://json.org/
     
    MMJ, Jan 21, 2008 IP
  7. procmail

    procmail Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I think something like this is being referred to:

    http://developer.yahoo.com/common/json.html#callbackparam
     
    procmail, Jan 21, 2008 IP
  8. akram

    akram Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    This is how JSON worked for me in cross site scenario:

    Dynamically load a JavaScript file by passing your parameters threw GET.

    The JS file will return the JSON array...

    Parse the JSON for the data or use evol() function to execute the JS code...
     
    akram, Jan 22, 2008 IP
  9. webexpert

    webexpert Banned

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    as per my experience.. you cannot make ajax requests via http..
     
    webexpert, Jan 22, 2008 IP
  10. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #10
    lol, how else are they sent?
     
    MMJ, Jan 22, 2008 IP
  11. webexpert

    webexpert Banned

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    ooops - actually i wanted to say; in ajax response we can only get the html, i mean if there are any css or javascripts included as external files then we cannot have full functional page as ajax response.. makes sense now?

     
    webexpert, Jan 22, 2008 IP