jQuery:
function myajax(var){
$.ajax({
url : 'ajax.php',
type : 'POST',
dataType : 'html',
data: {
if(undefined != var){ variable : var, }
content : $("#myinput").val()
}
}
However, when calling the above function, the console shows Unexpected token ( for the line with the if. How can I do this successfully? Thanks!