0

I call an ajax function to set my div content, the content i want to display is an inout field for my form. I used the code below but my div still empty any suggestions please?

var v1='echo $this->Form->input("heure",array("label"=>false,"class"=>"form-control","default"=>"1200","options"=>'+array+'));';
jQuery('#ReservationAddForm #diiv').html('<?php  '+v1+'   ?>');
Afaf
  • 654
  • 1
  • 5
  • 17
  • what's the point in using two nested id selectors? – Barudar Nov 30 '16 at 09:58
  • you cannot pass PHP code via js. It won't be executed. This is not ajax. – Lelio Faieta Nov 30 '16 at 09:59
  • @LelioFaieta I know that's the proble bcause when i do jQuery('#ReservationAddForm #diiv').html(v1); I got exaclty what I want so any suggestion please to deal with this problem? – Afaf Nov 30 '16 at 10:03
  • @Barudar that has no negative effect – Afaf Nov 30 '16 at 10:04
  • @AfafBENZINOUN I understand that, but I thought there was maybe a good reason to do that, otherwise it just complicates the code and worsen CSS maintenability, just my opinion though – Barudar Dec 01 '16 at 14:48
  • @Barudar thanks for sharing your opinion btw I solved the problem by appending the attribute option for each value – Afaf Dec 01 '16 at 16:04
  • @AfafBENZINOUN you're welcome – Barudar Dec 05 '16 at 11:08

0 Answers0