复选框选中 则 sogou=yes
复选框未选中 则 sogou=no
$("a").click(function(){
$.ajax({
type:"POST",
url:"../ajax/",
cache: false,
data:{
sogou: "yes",/////////就是这个值
sid:Math.random()},
dataType:"json",
beforeSend:function(loading){
$('#loading').html('<img src="ajax-loader.gif"/>');
$('#success').html('');
},//end befor
success:function(json){
$('#loading').html('');
$('#success').html(json['callback']);
//$( "#dialog-message" ).dialog( "close" );
},//end success
error: function(XMLHttpRequest, textStatus, errorThrown) {
var msg = "Sorry but there was an error: ";
$("#loading").html(msg+XMLHttpRequest.status);
}//enderror
});//end ajax
});
<input type="checkbox" name="check" checked="checked" id="fcr" />mycheck<br />
复选框未选中 则 sogou=no
$("a").click(function(){
$.ajax({
type:"POST",
url:"../ajax/",
cache: false,
data:{
sogou: "yes",/////////就是这个值
sid:Math.random()},
dataType:"json",
beforeSend:function(loading){
$('#loading').html('<img src="ajax-loader.gif"/>');
$('#success').html('');
},//end befor
success:function(json){
$('#loading').html('');
$('#success').html(json['callback']);
//$( "#dialog-message" ).dialog( "close" );
},//end success
error: function(XMLHttpRequest, textStatus, errorThrown) {
var msg = "Sorry but there was an error: ";
$("#loading").html(msg+XMLHttpRequest.status);
}//enderror
});//end ajax
});
<input type="checkbox" name="check" checked="checked" id="fcr" />mycheck<br />
$("a").click(function(){
var sougouVal = ($("#fcr")[0].checked ? 'yes' : 'no');
$.ajax({
type:"POST",
url:"../ajax/",
cache: false,
data:{
sogou: sougouVal,
sid:Math.random()},
dataType:"json",
beforeSend:function(loading){
$('#loading').html('<img src="ajax-loader.gif"/>');
$('#success').html('');
},//end befor
success:function(json){
$('#loading').html('');
$('#success').html(json['callback']);
//$( "#dialog-message" ).dialog( "close" );
},//end success
error: function(XMLHttpRequest, textStatus, errorThrown) {
var msg = "Sorry but there was an error: ";
$("#loading").html(msg+XMLHttpRequest.status);
}//enderror
});//end ajax
});