Ako spracovať response s odoslaného formulára
- KristianSubweb
- Člen | 146
Po úpešnom osdoslaní formulára si nechávam posielať data o uspešnom odoslaní cez JSON. A moj problém je v tom že neviem ako ho mám spracovať kedže nejde o mnou napísaní ajax. Používam na button submit class ajax.
<div class="modal fade" id="addFolder" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
{form addFolder}
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">{_is.multimedia.addFiles}</h4>
</div>
<div class="modal-body">
<div class="">
<div class="form-group">
{label name class => "control-label" /}
{input name class => "form-control isRequired"}
</div>
<div class="form-group">
{label project class => "control-label" /}
{input project class => "form-control"}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left strong" data-dismiss="modal">{_is.default.close}</button>
<button n:name="submit" class="btn btn-success ajax">
{_is.multimedia.addFolder} <span class="glyphicon glyphicon-ok"></span>
</button>
</div>
{/form}
</div>
</div>
</div>
public function createComponentAddFolder()
{
$form = $this->multimediaFolderFormFactory->createAddForm($this);
$form->onSuccess[] = function() {
if($this->isAjax()){
$json = Json::encode(1);
$this->payload->success = $json;
$this->sendPayload();
}
};
return $form;
}
V prehliadači po uspešnom odostaní mám object {„success“:„1“} a ten chcem spracovat len neviem príklad ako to dostanem do console.lo()
Neviete niekto poradiť ? Ďakujem
Editoval KristianSubweb (27. 9. 2018 11:54)