Link to home
Start Free TrialLog in
Avatar of paldie
paldieFlag for United States of America

asked on

jQuery.ajax Not Populating responseText

I have built the following function to make a search query against my server with jQuery's ajax call:
function searchProducts(keywords,container,clicker,exclude){
	/*
	 * @param keywords - words in the title of the category
	 * @param retContainer - the container for the results
	 * @param clickHandler - function to handle clicking of links returned
	 * @param exclude - a list of excluded category IDs
	 */
	var data = 'query=' + encodeURIComponent(keywords) + '&clicker=' + clicker;
	if(typeof exclude == undefined)data = data + '&exclude=' + exclude;
	else data = data + '&exclude='
	var rethtml = jQuery.ajax({
		url:'/index.cfm?action=admin:products.search',
		dataType:'html',
		data:data,
		asynch:false,
		type:'GET'
	}).responseText;
	container.html(rethtml);
	
	return true;
}

Open in new window


The ajax makes the call just fine and if i open firebug I can see the request and the HTML that it returned, but for some reason the responseText variable isn't being populated.  Can anyone see an error with my function call?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of paldie

ASKER

Thanks.  I knew it would be something really simple, but I ran into one of those "I've been looking at this code for 2 straight days" situations.  Just needed that third eye on it.
You're welcome! Thanks for the points!