I am trying to send a name:value pair to a php script using the $.post object in jQuery where both name and value are variables. I have sent the variables to the console in FF, so I know they are being set correctly, but when I view the headers being sent, only the value variable is being evaluated correctly, the name is being sent as a literal string of the variable name. Here is the function in its entirely:
$(document).ready(function() {
$('#formS form fieldset > input').blur(function() {
if($(this).val()=='' && $(this).prev().is('img')) {
$(this).prev().remove();
return;
}
if((($(this).is('#formS form fieldset > input[id*=mail]')) ||
($(this).is('#formS form fieldset > input[id*=sername]'))) &&
($(this).val()!="")) {
var email_field = $(this);
if(!$(this).prev().is('img')){
$('<img src="" alt="" style="width: 16px; height: 16px;" />').insertBefore(this);
}
var type = ($(this).is('input[id*=sername]'))?'username':'email';
var value = $(this).val();
$.post('checkemail.php5', {type:value}, function(data) {
if(data == "free") {
email_field.prev().attr('src','/images/greentick.png').attr('alt','available');
} else if(data == "taken") {
email_field.prev().attr('src','/images/redcross.png').attr('alt','taken');
} else {
console.log('hmmm'+data);
}
});
}
});
});
So, the headers being sent are the literal string type, and whatever value evaluates to. Anybody have any ideas why?