从另一页

时间:2018-01-06 17:50:00

标签: jquery ajax

请勿更改,我希望选择默认节目<option value = "content1" selected> content1 </ option> 请参阅my code

<select id="select123">
<option value="content1">content1</option>
<option value="content2">content2</option>
<option value="content3">content3</option>
<option value="content4">content4</option>
</select>
<div id="content"></div>
<img src="loading.gif" id="loadingImage" style="display: none;" />

MY-page.php文件 //my-page.php

<div id="content1" class="content123">text defult show</div>
<div id="content2" class="content123">contentttttttt</div>
<div id="content3" class="content123">content3</div>
<div id="content4" class="content123">content4</div>

我的jQuery(ajax)代码in jsfiddle

    jQuery(function($) { 
    jQuery('#select123').change(function() { 
    jQuery("#loadingImage").show(); 
       jQuery.ajax({ method: "POST",
     url: "my-page.php",
     data: { workselected1: jQuery(this).val() },
     success: function(data){ console.log(data); }
     jQuery("#loadingImage").hide();
 }); }); });

1 个答案:

答案 0 :(得分:0)

我希望其中一位教授会帮助 <?php $array = array("A","B","C","D","E","F","G","H","I","J","K"); $items = old($field['name']) ? (old($field['name'])) : (isset($field['value']) ? ($field['value']) : (isset($field['default']) ? ($field['default']) : '' )); ?>