What does this line mean? - $ .ajaxSetup ({scriptCharset: "utf-8", contentType: "application / x-www-form-urlencoded; charset = UTF-8"

1

Hello, I'm analyzing a programming already done to learn, it's working, but I've arrived in this part and I'm not finding the meaning of it online.

Could anyone help me?

Follow the line of code:

$.ajaxSetup({ scriptCharset: "utf-8" ,contentType: "application/x-www-form-urlencoded; charset=UTF-8" })

Thank you very much.

    
asked by anonymous 04.07.2017 / 15:57

2 answers

1

These are only ajax connection settings containing specifications about the type of charset and the content that will be trafficked in HTTP request.

To better understand the arguments defined in this function, you will have to study a little bit about the structure of the HTTP protocol (It would be interesting to research your derivative as well, which is TCP), but in summary, the above code only specifies the content Type and the type of data that will be passed in the request.

Interesting links:

04.07.2017 / 16:06
1

This line defines a default setting for future AJAX requests to be made via jQuery.

Instead of setting these assets on all calls, you can pre-determine them and save some rows when you need to make requests.

The method page in the jQuery documentation gives some examples about: link

    
04.07.2017 / 16:04