1
I have a button on a page that when clicking it performs the following code:
Note: Whenever I click on this button it reloads a php page with html data, the jquery scripts. But there comes a point q it loops in the search of jquery scripts.
Any idea why this occurs?
$('#return').on('click',function(e){
e.preventDefault();
clearChildren(document.getElementById('savepesquisa'));
$('form')[0].reset();
blockUnblok(0,idvarejo,4);
$.ajax({
url: "pesquisas.php",
type: "GET",
success:function(data){$('#loadhtml').html(data);}
});
});
function blockUnblok(option,idvarejo,status,iduser){
if(option == 1){
var blockId = $.ajax({
url: 'dadosPS.php?ps=BlockId&id=' + idvarejo + '&idStatus=' + status,
dataType: "json",
async: false
}).responseText;
}else if(option == 0){
var unblockId = $.ajax({
url: 'dadosPS.php?ps=ReleaseId&id=' + idvarejo + '&idStatus=' + status,
dataType: "json",
async: false
}).responseText;
}else if(option == 2){
var updateAgenda = $.ajax({
url: 'dadosPS.php?ps=UpdateAgendamento&idStatus=' + status + '&varejo=' + idvarejo + '&idUser=' + iduser,
dataType: "json",
async: false
}).responseText;
}else{}
}
This 'blockUnblok' function is yours?
– Wictor Chaves
yes Wictor she executes an asynchronous ajax query.
– Carlos Lopes
Post her code too, the problem may be there.
– Wictor Chaves
I updated the code.
– Carlos Lopes
This blockUnblock code performs a simple update where I get no return from anything.
– Carlos Lopes
That one
blockUnblock
is complete? Why can’t I see him updating anything, just catching theresponseText
of a request synchronous.– Marco
What comes of the result of the request made in
pesquisas.php
? Is there any script come together in this result?– Marco
Just with the passages posted does not make sense this repetition that you mention.
– Marco
In the.php query returns a full page with inputs and functions . and is loaded in a div. when I click on the Return button, it clears the marked inputs and loads the page queries again by ajax.php.
– Carlos Lopes