• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 61
  • Last Modified:

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

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(){ 
      $("#ajax-block-2").empty();
	  $("#criteria_tab").removeClass("selected");
	  $.when(show_loader()).done(function(a1){
		  $.ajax({
			url: 'php/pic-search.php?use=rating',
			type: 'POST',
			data: $('form#basic_search_form').serialize(),
			success: function(data) {
				$("#big-loader").remove(); 
				$("#ajax-block-2").html(data);
			},
			error: function(xhr, textStatus, errorThrown){
				alert("There was an error: "+textStatus);
				$("#big-loader").remove();
			}
		});
	});		
 }

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!
0
Elxn
Asked:
Elxn
  • 3
  • 2
1 Solution
 
gr8gonzoConsultantCommented:
I don't see a form with that ID in your source.
0
 
gr8gonzoConsultantCommented:
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:

$('form#basic_search_form').serialize();

...and see what the output is. Inspect all of the values in your AJAX request.
0
 
ElxnbossAuthor Commented:
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.
0
 
ElxnbossAuthor Commented:
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.
0
 
ElxnbossAuthor Commented:
solved myself.  Close it up.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now