What I'm doing is basically using 3 files which I describe below
//File1.php
$('button.button1').click(function(e){
$.ajax({
type: "POST",
url: "file2.php",
timeout: 180000
})
.done(function(data) {
//load data returned in modal
})
.fail(function(msg) {
//do something
});
});
Then, my next file load modal code html (header,body and footer) with a button called 'OK'. (The body modal contains a form with the button 'OK')
//file2.php
$('button.ok').click(function(e){
$.ajax({
type: "POST",
url: "File3.php",
contentType:false,
processData:false,
cache:false,
data: formData,
timeout: 180000
})
.done(function(data) {
//do something
}
})
.fail(function(msg) {
//do something
});
});
In my file3.php do bd operations and save the values
So, when executing the program from the first script, the page is automatically returned to the index and the query is not executed in the bd, what is this? That I should return in each file to be executed correctly and why the values are sent through the get method (they are seen in the url) when it is specified that the method is post? HELP
to conclude, i have one button that do an ajax call , load a modal and inside the modal another ajax call is done