Wrexer
11-16-2009, 06:02 PM
Hello everyone,
I've recently run into a problem and wanted some feedback on how to resolve it. I am writing a CRM system that updates fields once the field loses focus. I have a javascript function set as the onblur action for each field which sends the new value to the server and then receives the response back on whether it was successful or not. It works well unless the user is focused on one of the fields and then clicks a hyperlink somewhere on the page. When they do this, the AJAX request isn't able to send the request and receive the response before the page changes to the hyperlink URL.
Any ideas on how to resolve this? One solution I was considering was to have some jquery run once the page is loaded and replace all hyperlinks with a javascript function that would first check if there are any requests pending before following the URL. I haven't tried that yet and I'm not 100% sure it would work. All suggestions welcome, thanks.
I've recently run into a problem and wanted some feedback on how to resolve it. I am writing a CRM system that updates fields once the field loses focus. I have a javascript function set as the onblur action for each field which sends the new value to the server and then receives the response back on whether it was successful or not. It works well unless the user is focused on one of the fields and then clicks a hyperlink somewhere on the page. When they do this, the AJAX request isn't able to send the request and receive the response before the page changes to the hyperlink URL.
Any ideas on how to resolve this? One solution I was considering was to have some jquery run once the page is loaded and replace all hyperlinks with a javascript function that would first check if there are any requests pending before following the URL. I haven't tried that yet and I'm not 100% sure it would work. All suggestions welcome, thanks.