I'm using a Jquery Ajax POS request to send JSON data from my chrome extension to my server, then having a response sent containing javascript to be executed on the client side. How should I set my contentType and dataType to achieve this? I'm currently getting a 'contentType is not defined' error message.. code below:
client.js
request("https://a304cff8.ngrok.io/api/panels/hitme", "post", "json", {apples})
.done(function(res){
console.log(res)
})
})
function request(url, method, contentType, data){
return $.ajax({
url: url,
method: method,
contentType: contentType,
data: data
})
}
function demo () {
$(".abc").click( function(e){
if(e.which == '10' || e.which=='13') {
e.preventDefault();
return;
}
var xyz=$(this).val();
$.ajax({
url:'jquery-data.php',
type:'GET',
dataType:'JSON',
data:{........},
success:function(data,textStatus,jqXHR) {
// showing return status
}
});
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.