2
I have the following code on jQuery
$.post('/privmsg?', {
folder: 'inbox',
mode: 'post',
post: '1',
username: 'Wagner',
subject: 'Título',
message: 'Mensagem'
});
I am studying Javascript, and would like to do the same effect with pure Javascript.
I did some research and learned to make requests with GET with AJAX, now I would like to know, how do this POST with pure Javascript?
I understand, but one thing I haven’t learned yet, is to pass the data (date) with JSON, you would have some example of how to do it?
– waghcwb
What do you mean don’t use jQuery? Heresy! See: When is "use jQuery" not a Valid Answer to a Javascript Question? and this illustrative image. ;)
– Anthony Accioly
@waghcwb Simply create an array with
{}
like you did with jQuery– user7261
@Anthony So It Is. Benchmarks show that jQuery is slow, the problem is running out of browser compatibility and the ton of plugins that require jQuery.
– user7261
I agree with Andrey, jQuery is not always feasible. Some projects are interesting to use, but others I myself do not see the need.. @Andrey, I did it this way, but no results: http://pastebin.com/TQd90hyw
– waghcwb
@waghcwb Strange, I thought it was supposed to work.
– user7261
@Andrey, I got a satisfactory result as follows: http://pastebin.com/AWyQqRq7 But I couldn’t do it with JSON. Weird..
– waghcwb
I think as follows, in programmers we are masters, we have to know how to use the maximum resources and safely and efficiently. Work with both, run tests, check processes, look for forms you’ve already created. ’s website is also very rich with java script and other derivatives. = D
– user78859