0
help!
I’m making a registration with AJAX and PHP, Registration is OK, however, I need to run a search soon after the Registration is completed, the structure is MVC:
VIEW -register.php
CONTROLLER - custom control.php
MODEL - template.php
ASSETS - order.JS
When I register an order, my control returns the ID of this registered order, I want to take this ID and then execute the other method Localization ($idencomenda), if I put in the browser (http://localhost/levarte/control-order/location/15) with the parameter I can execute, however, I need it to be automatic for the user.
My Javascript is what makes posts.
$('#form_encomendabarco').submit(function () {
//dados encomenda aviao
var datasaida = $('#datasaida').val();
var estadoorigem = $('#estadoorigem').val();
var estadodestino = $('#estadodestino').val();
$.ajax({
url: "http://localhost/levarte/controle-encomenda/salvarEncomendaBarco",
type: "post",
data: {
datasaida : datasaida,
estadoorigem : estadoorigem,
estadodestino : estadodestino,
},
beforeSend: function () {
alertify.message('PROCESSANDO!');
},
success: function (resultado) {
if (resultado != 2) {
alertify.message('LOCALIZANDO VIAGEM');
////AQUI INICIO O ENVIO DO RESULTADO QUE NA VERDADE É O IDENCOMENDA
$.ajax({
type: "POST",
url: "http://localhost/levarte/controle-encomenda/localizaViagemBarco",
data: {
resultado: resultado,
},
beforeSend: function () {
alertify.message('LOCALIZANDO VIAGEM!');
alertify.message(resultado);
},
success: function (data) {
//AQUI DEVERIA CARREGAR A TELA COM O RESULTADO
$('#content').html(resultado);
alertify.message("VOLTOU");
}
});
Registration occurs, but nothing after that.
Can’t you make the function call within php itself? When finishing the registration and with the Order ID, calls within php the Function Localization ($idencomenda) inside php itself and not returning an AJAX result then calling another AJAX.
– Marcus Italo