Jump to content

Recommended Posts

I have a bunch of data in some client-side javascript code that I want to get to php code.  I would typically just manually build the url string to send it over in GET, but because of the amount of data, this is not possible.  So as far as I know, the only other method I have is to use POST.  And the only way I know how to do this is to build a form by adding elements to the dom and submit it.  However, this is rather ugly, is there any easier way?

Link to comment
https://forums.phpfreaks.com/topic/106213-solved-data-from-javascritp-to-php/
Share on other sites

From my understanding, hidden iframes are used to have persistent data in javascript, but you can't use one to transfer data from javascript to php.  Is that correct?

 

I didn't realize this before, but the size of the arrays I have to transfer can be determined when the php script is running.  So I can create a hidden form by just using php to make html instead of modifying the dom, and then submit it by javascript code (I think?) which will send the data needed in POST.

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.