views:

4199

answers:

4

Hi there,

Is there anyway that i can open a new window in the browser using jquery and post to it.

Reason being is my bank requires that i open there payment gateway and pass my values by POST and not GET.

I have a bit of workaround at the moment but its not idea.. I used QUERYSTRING to an ASPX page withing some hidden forms and submit the form to my bank

but its really not good.

Maybe jquery can do this natively or using a plugin?

Any ideas?

Thnaks

+7  A: 

Stackoverflow Archive:

Google Results:

Jonathan Sampson
A: 

How about using the target attribute (_blank) of a form and posting to a new window?

The target attribute of the form element was deprecated in HTML 4.01, and is not supported in XHTML 1.0 Strict DTD, so if that's important to you it won't work.

ScottE
A: 

I never used JQuery but this is how I do it with plain Java Script.

Maybe you can port it to JQuery syntax:

window.open("",'myWindow','scrollbars=yes, resizable=yes'); 
window.setTimeout("document.myFormName.submit();",500);

myFormName has to mach the 'name' attribute of the Form.

see:

A: 

do you really need a new window? with jQuery.post() ( http://docs.jquery.com/Ajax/jQuery.post#urldatacallbacktype ) you could make a async post to the bankpage and display its return value as you like.

maybe the bank page even has the option to return json data instead of plain html.

hth

marc.d