Pass serialize data

Hi, I just want to ask some help regarding in window.open,is it possible to pass data serialize form?

I tried this but it would not work


  dataform = $('#myform').serialize();
  window.open('anotherpage.php?data='+dataform);

Thank you in advance.:slight_smile:

Have you seen what the dataform string contains? It will contain key/value pairs so they won’t be accessible via the data key, but instead through the names of the form fields instead.

Hi paul,
Thank you for the reply,yes i tried to use the names of the fields and it’s working but can i ask
is it possible to use the window.open and encrypt the data I mean the parameters?

You can use Base64 encoding but of course anyone can decode the string, if you want to protect the data you would need to post the data instead of using a query string.

What kind of data are you trying to pass between pages in this way? You may be better off putting the data in a session on the server, or in a DB, depending on what kind of data you’re working with.

Is is it possible to post the data using window.open?

Hi fretburner, I have this kind of data since i could not pass data using the serialize form,I just do it like this window.open(‘tootherpage.php?bankname’=+banckname+‘&address=’+address etc…);

you mean to do this in session like this

$_session[‘bankname’] = “mybankname”;
$_session[‘address’] = “banckaddress”;
etc…

Thank you in advance.

Well, as you’re talking about data from a form, why not just submit the form in the normal way? And if you’re dealing with sensitive data such as bank details you should only do this over HTTPS.

Hi fretburner,
what do you mean by this,sorry i could not get :slight_smile:

should only do this over HTTPS.

I mean that if you’re going to be submitting sensitive data, it’s not safe enough just to submit by post. You need to submit the form over a secure connection (i.e your form action will be something like: https://www.example.com/account/mybankdetails.php).

Hi fretburner, I don’t know how to do https do i have to configure in my server in order to get the https ?

You need to buy a SSL certificate and ask your hosting company to install it for you. Then usually your files are available via both http and https.

Thank you fretburner for this information :slight_smile:

Its not hard to post data to a new window, all you need to do is set the target on the form itself to the name of the popup window and when you hit submit the data will get posted to it instead of reloading the current page. See the following link for an example.