WEB GET HTTP BODY($body)
http://doc.4d.com/4Dv15/4D/15.4/WEB-GET-HTTP-BODY.301-3275031.en.html

> On Apr 4, 2017, at 5:16 PM, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Hi folks,
> 
> I need a little guidance here. I have a web form (in a browser) that is
> submitting data to 4D. I collect the data on the webform into an object
> then stringify it for passing to 4D - like so:
> 
> var postData = JSON.stringify(woData);
> $.post( "/workorder/data", postData)
> .done(function(data) {
> if(data.error){ // show the error
> swal(data.error, '', 'warning');
> } else {
> swal(data.pageMsg, '', 'success');
> }
> })
> .fail(function() {
> swal('Fail!');
> })
> .always(function() {
> // alert( "complete" );
> });
> 
> 
> ​I​ expected (because I saw it work this way in Tim Penner's great example
> db) on the 4D side I could do something like this:
> 
> ARRAY TEXT($at_names;0)
> ARRAY TEXT($at_values;0)
> WEB GET VARIABLES($at_names;$at_values)
> 
> ​and $at_names{1} would equal "data" and ​$
> at_values
> ​{1} would be the JSON.
> 
> Instead what I get is ​
> 
> $at_names{1} = first part of the JSON
> $at_values{1} = the second part of the JSON
> 
> ​Now, the good news is this seems to be consistent. I can concatenate the
> two parts and parse it fine.
> But I don't understand why it's working this way.
> 
> ​The data payload varies in length but isn't huge. It contains a few
> fields, some text and a couple of JSON arrays. It is too long to encode
> into the URL though so
> 
> $.post( "/workorder?data=" + postData)
> 
> ​doesn't work. (I tried.)
> 
> ​I'm hoping someone can either correct my approach or assure me it's OK.
> 
> Thanks, I really appreciate the help. ​
> 
> 
> -- 
> Kirk Brooks
> San Francisco, CA
> =======================
> 
> *The only thing necessary for the triumph of evil is for good men to do
> nothing.*
> 
> *- Edmund Burke*
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to