Jump to content

help with this code


brown2005

Recommended Posts

$(document).ready(function() {

$.ajax({
	type: "GET",
	url: "ajax-search.php",
	success: function(server_response){
		$('#results').html(server_response).show();
	}
});

$("#blocked").click(function() {

	var dataString = 'blocked=1';

	$.ajax({
		type: "GET",
		url: "ajax-search.php",
		data: dataString,		
		success: function(server_response){
			$('#results').html(server_response).show();
		}
	});

});

});

 

I have the above code which works fine.. the results are loaded up on the load of the website. Then when I tick the checkbox it takes away results that have been blocked, but what i wanna do is when i on tick the box to remove the blocked=1 and then get the results.

 

thanks in advance.

Link to comment
Share on other sites

I have the code doing what I want, when i tick say the block checkbox it removes blocked results then untick it adds them back. This works for the seen before checkbox two, but I want to combine the two so that if they are both checked will remove blocked and seen before results.

 

Thanks in advance.

 

$(document).ready(function() {

$.ajax({
type: "GET",
url: "ajax-search.php",
success: function(server_response){
$('#results').html(server_response).show();
}
});

$("#blocked").click(function(){
  
if($('#blocked').is(':checked')){

var dataString = 'blocked=1'; 

}else{

var dataString = 'blocked=0';

}

$.ajax({
type: "GET",
url: "ajax-search.php",
data: dataString, 
success: function(server_response){
$('#results').html(server_response).show();
}
});

});

$("#seen").click(function(){
  
if($('#seen').is(':checked')){

var dataString = 'seen=1'; 

}else{

var dataString = 'seen=0';

}

$.ajax({
type: "GET",
url: "ajax-search.php",
data: dataString, 
success: function(server_response){
$('#results').html(server_response).show();
}
});

});

});

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.