I have a chunk of code that defines divs and some of the callbacks on them when clicked. To avoid code redundancy, I want to reuse it. The callbacks use $.post calls to communicate with the server whereas, for this specific page, I want a page refresh the way a form submit does.
Is there any difference in using a form submit to submitPage.php and using the following?
$.post('submitPage', dataParams, null, 'json').
success(function(resp, status, req) {
window.location = 'submitPage.php'; // redirect
});
I am curious about how this might intrinsically effect the processing of entries in dataParams by submitPage.php.