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
https://forums.phpfreaks.com/topic/215787-javascript-wjquery-post-a-page-request/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.