So I am trying to use something like the below code to send post data but I need to send with json as the format.
$.post(baseUrl + 'main', {
meta: '1',
metaOut: '1',
hashcode: hashCode,
url: inputHost
}
I know about the $.ajax way but there are many functions already using the $.post so I'd have to convert all.
$.ajax({
type: "POST",
crossDomain: true,
headers: {"Content-Type": "application/x-www-form-urlencoded",},
dataType: "json",
url: baseUrl+'get-image',
data: {_token: _ourtoken, site: inputHost},
success: function (result) {
console.log(result.messages.success);
},
error: function (result) {
console.log(result.responseText);
}
});
Looking for a way to either make all posts inside this .js file send with json or for each $.post, make it send with json format.