App creation comment function asynchronous

Asynchronization description explanation

スクリーンショット 2020-07-20 21.51.14.png

FormData It can be used to submit form data. Alternatively, it can be used independently of the form to carry keyed data. This time we have a comment form, so we'll use it to get information about that form.

attr method

Returns the value of the specified attribute that the element has. If the element does not have the specified attribute, the function returns undefined.

processData option

It is true by default and is responsible for converting the object specified in data to the query string (eg msg.txt? B1 =% E3% 81% 8B & b2 =% E3% 81% 8D). The query string is the data sent to the web server by a web browser, etc., written in a specific format at the end of the URL.

contentType option

A header that tells the server the file format of the data. By default, this is "text / xml" and returns the content type as XML.

When the ajax request is FormData, both values can be sent in the appropriate state, so setting it to false prevents the setting from being overwritten.

スクリーンショット 2020-07-20 21.59.49.png

After this, I would like to add an incremental search function.

Recommended Posts

App creation comment function asynchronous
Implemented comment function
Comment function (Ajax) implementation
About immediate comment update function
[Rails] New app creation --Notes--
[Rails] Asynchronous implementation of like function
Real-time comment function with Action Cable (2/2)
About error handling of comment function
[Ruby on Rails] Comment function implementation
[Rails 6] Like function (synchronous → asynchronous) implementation
[Rails] Comment function implementation procedure memo