KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have run into a problem with the AJAX response using jquery (and coldfusion serverside). Sometimes it works and sometimes it doesn't. When I test the serverside component calling it directly - it always works, so I guess the problem is with the ajax response. I get the serverurl, directly from the server - so it shouldn't be a cross-domain issue. I just show and hide div-tags so it shouldn't be about relocating the url before the ajax response has been processed. I am pulling out a lot of hair over this. The code for the addTask method: function addTask(){ var priority = $('#ff-add-task-priority').length > 0 ? $('#ff-add-task-priority').val() : 0; $.ajax({ url: settings.server+'/c/Tasks.cfc?method=addTask', data: { userid: settings.userid, taskname: $('#ff-add-task-name').val(), tasknote: $('#ff-add-task-note').val(), completed: $('#ff-add-task-completed').val(), priority: priority, }, type: 'POST', dataType: 'json', success: function(response) { var output = addRow(response, $('#ff-add-task-name').val(), 0, 0); $('#data-list-tasks').append(output); $('#main').children().addClass('hide'); $('#section-list-tasks').removeClass('hide'); resetForm($('#add-task-form')); //route('#section-list-tasks'); }, error: function(ErrorMsg) { console.log('Error', ErrorMsg); } }); } Firebug output shows that the AJAX calls works sometimes and sometimes it fails.: POST http://dev.wedoolist.com/c/Tasks.cfc?method=addTask jquery.min.js (linje 2) Error Object { readyState=0, status=0, statusText="error"} #secti...t-tasks (linje 124) POST http://dev.wedoolist.com/c/Tasks.cfc?method=getTasks 200 OK 152ms jquery.min.js (linje 2) POST http://dev.wedoolist.com/c/Tasks.cfc?me
Tags (comma-separated)
Save Edits
Cancel