<select id="pasp_option"></select> -
function generate_pasport() { $.post("<?php echo base_url();?>admin/generate_pasport", {}, function (data) { $("#pasp_option").html(data); }); } generate_pasport(); alert($("#pasp_option").html()); - function generate_pasport() { $.post("ad...">
<select id="pasp_option"></select> -
function generate_pasport() { $.post("<?php echo base_url();?>admin/generate_pasport", {}, function (data) { $("#pasp_option").html(data); }); } generate_pasport(); alert($("#pasp_option").html()); If we take for the fact that the page <?php echo base_url();?>admin/generate_pasport gives you the result in the form
<option>a</option> <option>b</option> ... That error should not be.
Of course, js tags are needed here:
<script> </script> + In your case, the .load() operator is most suitable. Total, on an output we will receive a code:
<select id="pasp_option"></select> <script> $("#pasp_option").load("<?php echo base_url();?>admin/generate_pasport"); </script> <?php echo base_url();?>admin/generate_pasport this link in the browser <?php echo base_url();?>admin/generate_pasport - do you see what the page should display? - Vitalii Maslianok<option value='3'>111</option><option value='6'>114</option> $ ("# pasp_option"). Load ("<? Php echo base_url ( );?> admin / generate_pasport "); This works $ ("# pasp_option"). Html ("<option value = '3'> 111 </ option> <option value = '6'> 114 </ option>"); aaa = $ ("# pasp_option"). html (); alert (aaa); - AidosSource: https://ru.stackoverflow.com/questions/151729/
All Articles
$("#pasp_option").html(data);- Vitalii Maslianok