2
this.getArray = function(callback){
$http({
method: "post",
url: "index.php?modulo=ClientesOnline&acao=getClientes",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: $.param({ajax:1}),
}).success(callback);
//$http.post("index.php?modulo=ClientesOnline&acao=getClientes", {ajax:1}).success(callback);
};
Guys, the code above was done by me through various searches.
My doubt
Is there any easier way to write that line:
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
For 'application/x-www-form-urlencoded'
is a little tricky to write in everyday life. :/
Thanks in advance! Thanks.
That’s right, there’s a way?
– Pedro Soares
You can leave the text in a file or resource snippet of the IDE and put in the code in the very few times it is necessary.
– Maniero