Skip to content Skip to sidebar Skip to footer

Button OnClick Event And Href-Location

I used a solution given by 'Chrules' found in this discussion:buttons with no href, onclick etc like this : ...... $('#clic

Solution 1:

I think insertMethod() calls some async functions to do database updating. So you should use a callback before doing anything else.

Something like this (i don't know what is inside of insertRecord method);

function insertRecord(callback) {
  // do all sorts of database job
  // when it's finished
  // fire your callback
  callback();
}

insertRecord(function() {
  location.href = "page.html";
});

EDIT: After your comment, i see you already have defined a function to run after sql which is loadAndReset(). So simply put location.href = "page.html" in that function, and it should work.


Post a Comment for "Button OnClick Event And Href-Location"