Hi there,
I'm working on a project, but I'm a bit stuck. It's a logical question. I'll explain: We have a list of articles - Table: articles - saved in the database. However, we have collapse-able elements (let's call them accordeons now), which are based on the enabled languages (Table: languages). Now I'm tasked with saving every input for every "Accordeon" in the database, where content for the accordeons is stored in "article_language".
The accordeon (It's contained in a WHILE-loop)
<div class="accord">
<div class="accordeon-head" data-id="<?php echo $language['shortname']; ?>"><?php echo $language['fullname']; ?><div class="accordeon-right"><i class='fa fa-chevron-down'></i></div></div>
<div class="accordeon-body" data-id="<?php echo $language['shortname']; ?>">
<div class="form-container bottom">
<div class="form-float full-width">
<label class="input-label" for="agg_e_txt"><?php echo $lang['ARTS_INPL_TXT']; ?></label>
<textarea type="text" id="agg_e_txt" name="agg_e_txt"><?php echo $text['article_text']; ?></textarea>
</div>
<div class="clear toplabel"></div>
<div class="form-float middle">
<label class="input-label" for="agg_e_rec"><?php echo $lang['ARTS_INPL_RECUSE']; ?></label>
<textarea type="text" id="agg_e_rec" name="agg_e_rec"><?php echo $text['article_recuse']; ?></textarea>
</div>
<div class="space"></div>
<div class="form-float middle" style="float:right;">
<label class="input-label" for="agg_e_spec"><?php echo $lang['ARTS_INPL_SPEC']; ?></label>
<textarea type="text" id="agg_e_spec" name="agg_e_spec"><?php echo $text['article_spec']; ?></textarea>
</div>
</div>
<div class="clear"></div>
</div>
</div>
I'd like to do this with an AJAX post. What is the best way to store everything for an accordeon in the article_language table with the correct language prefix?
My thoughts were a WHILE loop in the AJAX call, or a each in the jQuery. But, I'm not sure.
What is the best way to achieve this?