Hello, all,
I have been working on a few forms that submit form data via $.ajax();
, and recently had a weird issue that I’m hoping someone can explain to me.
I have three forms that have been submitting data flawlessly. I have another form that was giving me a 404 (not found) error.
On the form that was giving me an error (it’s now fixed), I changed this:
$('#submitBtn').on('click',function(e){
frm = $('#estimateForm');
frm = frm.serializeArray();
postURL = 'http://www.domain.com/components/ERC.cfc?method=getCostEstimate';
$.ajax({
type: 'post',
url: postURL,
data: frm
}).done(function(data){alert(data)});
… to this:
$('#submitBtn').on('click',function(e){
postData = $('#estimateForm').serializeArray();
postURL = 'http://www.domain.com/components/ERC.cfc?method=getCostEstimate';
$.ajax({
type: 'post',
url: postURL,
data: postData
}).done(function(data){alert(data)});
The first was giving the 404 error; the second works just fine. Any ideas why?
V/r,