Jump to content

JavaScript [w/jQuery] - Post a page request


Joshua4550

Recommended Posts

Hey,

 

So. I wanted to post to an external script (cross-domain) in JavaScript. This is not my domain, though it's a partner.

 

I figured it would be SO MUCH easier to just post using jQuery's $.post() method, and problem solved. Well done! The problem was solved, until I ran it in IE - uh oh, IE doesn't like it?

 

I researched this problem, and it seems it's an IE security problem with cross-domain blahblah.

 

My question? How would I go about achieving the exact same result (just to post to the script, without actually making the user run it?) - I am not actually posting any _POST or _GET variables, I was only using $.post() because it was a convenient solution.

 

My old attempt, which IE didn't like?

    $.post('http://External_Site.com/External_Script.php');

(Obviously that isn't the real URL)

 

Any help?

Much appreciation for all help =)

Link to comment
Share on other sites

Figured.

 

Created a PHP script which grabs the url defined in a _GET parameter, and used file_get_contents() to display the script output.

 

This made me able to request a post to that script on the same domain.

 

I posted back just to allow any future people looking for the answer to this to find.

 

Thanks anyway

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.