We help IT Professionals succeed at work.

Can't Get Values to POST to a script via jQuery

Elxn asked
I've got a page, you can check out all the code by going here.  
Next click on the "criteria" tab and you'll see the form.

The form HTML is like:  <form id="basic_search_form">

The function called on click is as follows:
 function basic_search(){ 
			url: 'php/pic-search.php?use=rating',
			type: 'POST',
			data: $('form#basic_search_form').serialize(),
			success: function(data) {
			error: function(xhr, textStatus, errorThrown){
				alert("There was an error: "+textStatus);

Open in new window

The page produces data and this gets appended to the page, so I know its working kind of.  But for some reason there is no POST data being sent.  The post data keeps being empty for some reason.

Thanks for any help!
Watch Question

I don't see a form with that ID in your source.

Ah, okay, so it's loading up on AJAX or something. I would suggest just using Firebug to add breakpoints to your $.ajax line and run the search. Then when it hits the breakpoint, run the serialize manually:


...and see what the output is. Inspect all of the values in your AJAX request.


yeah its ajaxed in... you can check it out in chrome with "inspect element" it shows all the code that is there including ajaxed stuff.
OKay, I was a bit of a fool here.  The reason it wouldn't work was cause I emptied the form from the page before I tried to serialize the data, so there was no form to get data from.

Thanks for the help.


solved myself.  Close it up.