Open PHP without breaking JavaScript loop -
i'm iterating on table's values modify them if changes have been made user.
currently have similar to:
for (var = 0; < rows.length - 1; i++) { if (item[5]) { window.open("modify.php?id=" + id + "&delete=true"); } }
my question how can connect modify.php file without breaking loop. tried with
window.location("modify.php?id=" + id + "&delete=true");
too that's same story.
i considered using window.open , setting new windows dimension's small appears hidden , closing again after php has finished executing.
this seems ridiculously dumb hence why i'm wondering a/the better approach be?
it sounds want using ajax here. conciseness, i'll show mean using jquery.ajax
:
for (var = 0; < rows.length - 1; i++) { if (item[5]) { $.ajax("modify.php?id=" + id + "&delete=true"); } }
this sends asynchronous http request url provided.
ajax can done in vanilla javascript reasons of convenience , compatibility recommend using library.
Comments
Post a Comment