When I am using the following to respond to a button click, it it called (verified by using the console.log()), however, the http request it generated has the header Content-Type: application/x-www-form-urlencoded; charset=UTF-8rn. Shouldn't it be json?
I am using google chrome 34.0.1847.132 on Ubuntu. Jquery version 1.8.3.
Thanks in advance!
function action (mode) {
console.log(action called with mode + mode);
$.ajax({
type: POST,
url: '/saas.php',
data: {
action: (mode == 1)? start : stop
},
dataType: json,
success: function(data) {
//alert(data);
if (data.msg != null) {
alert(data.msg);
} else {
if (mode == 1) {
document.getElementById('createLoadGen').innerHTML = 'creating loadGen...';
setTimeout(checkStatus, 1000);
}
}
}
});
if (mode == 2) {
document.getElementById('createLoadGen').innerHTML = '<button onclick=action(1) >create LoadGen</button>';
document.getElementById('deleteLoadGen').style.display = 'none'
}
}