DEV Community

Discussion on: How to send Django form with AJAX

Collapse
 
enesislam profile image
enesstr • Edited

what about "data-name" attr? You can assigment an attribute that starts with "data-" to separate forms in ajax section.
For instance:

//html

li data-animal-type="fish">Salmon>/li>

//js
"""
data: {'content_id': $(this).attr('data-animal-type'),
'operation':'add_new_animal',
//We will got "fish" value.

"""

w3schools.com/tags/att_data-.asp