ux apost

Description

A wrapper for ux.ajax (POST)

Parameters

string

URL to load

object

JSON object with the parameters to send

function

Callback function to execute after the command receive a reply

object

JSON object with the options:

contentType

json|multipart|standard

timeout

Max time to wait a reply

loading

Block the app while sending/receiving data. Default: true

Return

void


Example


      ux.apost( 'http://www.url-to-send-post.com/path'
              , {data1:'hello',moreData:'World!'}
              , function(err, result) {
                  if ( !err /* && result hasn't errors */ ) {
                          ux.dialog(_t("Sent and Received!"),result, { buttons:[{id:'ok', title:_t("Ok"),type:"is-success"}] } );
                  } else {
                      ux.dialog(_t("Error"),_t("An unknown error happened. Please wait some seconds and try again."), { buttons:[{id:'ok', title:_t("Ok"),type:"is-danger"}] } );
                      ux.loading(false);
                  }
              }
          );

No Preview available