I kinda had a problem with my script. I've written this code
I know it doesn't well written because I'm in mobile until Saturday. But somehow it just doesn't work for me, it would redirect to the /post URL as usual. Can you help me? Thank you
- Code:
if(window.location.href.indexOf('post') && jQuery.ajaxSuccess) {
window.history.back;
}else if(window.location.href.index of('post') && jQuery.ajaxError) {
console.log('Error when submitting post.');
}else{
console.log('AJAX condition not found!');
}
I know it doesn't well written because I'm in mobile until Saturday. But somehow it just doesn't work for me, it would redirect to the /post URL as usual. Can you help me? Thank you