framework7 icon indicating copy to clipboard operation
framework7 copied to clipboard

submit custom ajax

Open chalchis opened this issue 10 years ago • 3 comments

Hello I am new to the framework 7 in jquery I could customize ajax send post by this way (JQuery.Deferred)

//enviar datos ajax

//datos para enviar por post

var datosPost = {
'tokentx' : jQuery('#formkey').val(),
'cuentaclietx' : jQuery('#txcuentaclie').val(),
'nomclietx' : jQuery('#txrazonsocialclie').val()
};

var enviar = jQuery.ajax({
url: “/domain/page.php”,
type: “POST”,
data: datosPost,
dataType: “json”,
timeout: 60000//60 sec
});

//si fue satisfactorio

enviar.done(function(json)

{

});

//hubo un error jqXHr, textStatus, errorThrown

enviar.fail(function(jqXHr, textStatus, errorThrown)

{

});

//siempre me ejecuto

enviar.always(function()

{

});

I do not see in framework7 something like that I hope you can help me regards!!

chalchis avatar Jan 27 '16 20:01 chalchis

my solution using traditional Ajax not Referred


$$.ajax({
myApp.showPreloader('Buscando cuenta');

url: ‘datos.php’,
method: ‘POST’,
dataType: ‘json’,
success: function(data)
{

},
error: function(xhr)
{

},
complete: function()
{
      myApp.hidePreloader();
}

});

is correct soluction??

regards!! welcome your comments

chalchis avatar Jan 27 '16 20:01 chalchis

There is no deferred objects/methods in Dom7 ajax, you need to use callbacks as a parameters or Ajax events or manual/custom promises (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)

nolimits4web avatar Jan 28 '16 10:01 nolimits4web

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jun 25 '18 22:06 lock[bot]