Php 如何在jQueryAjax调用的页面中触发静态方法

Php 如何在jQueryAjax调用的页面中触发静态方法,php,jquery,Php,Jquery,我的问题是,我有一个下拉框,可以根据我的选择加载内容。但是,在其中一个页面中,我获取内容时,有一个静态方法,我需要在显示内容之前调用该方法。该方法所做的只是检查会话中是否设置了该值。如果是,则填充该字段。如果我使用jquery ajax加载内容,该方法似乎不会启动。 以下是我根据选择加载的html: <table> <tr> <td><label class="required">Enter Current Number:</labe

我的问题是,我有一个下拉框,可以根据我的选择加载内容。但是,在其中一个页面中,我获取内容时,有一个静态方法,我需要在显示内容之前调用该方法。该方法所做的只是检查会话中是否设置了该值。如果是,则填充该字段。如果我使用jquery ajax加载内容,该方法似乎不会启动。 以下是我根据选择加载的html:

    <table>
<tr>
<td><label class="required">Enter Current Number:</label></td><td><input type="text" size=13 id="current_number"  name="current_number" value="<?php echo Util::getSessionValuebySessionName("phonePorting", "current_number"); ?>"></td>
</tr>
<tr><td colspan="2"><strong>Please Enter the Address associated to your current phone number</strong>
NOTE: You may only keep your current phone number if the address of your current phone number is in the same state as the address where you are signing up for CenturyLink service. </td></tr>
<tr>
<td width=20%><label class="required">Address Line 1:</label></td><td><input type="text" size=25  id="address_line1"  name="address_line1" value="<?php echo Util::getSessionValuebySessionName("phonePorting", "address_line1"); ?>" ></td>
</tr>
<tr>
<td>Address Line 2:</td><td><input type="text" size=25  id="address_line2"  name="address_line2" value="<?php echo Util::getSessionValuebySessionName("phonePorting", "address_line2"); ?>"></td>
</tr>
<tr>
<td><label class="required">Apartment:</label></td><td><input type="text" size=5  id="Apartment"  name="Apartment"   value="<?php echo Util::getSessionValuebySessionName("phonePorting", "Apartment"); ?>"></td>
</tr>

<tr>
<td><label class="required">City:</label></td><td><input type="text" size=15  id="City"  name="City" value="<?php echo Util::getSessionValuebySessionName("phonePorting", "City"); ?>"></td>
</tr>
<tr>
<td><label class="required">State:</label></td><td><select  id="State"  name="State"   >
<option value="">Select a State</option>
<?php foreach (Util::getStatesCodes() as  $key => $value) {?>
<option value="<?php echo $key; ?>" <?php Util::getSessionValuebySessionName("phonePorting", "City")==$key)echo "selected";?>><?php echo $key; ?></option>  
<?php }?>
</select>
</td>
</tr>
<tr>
<td><label class="required">ZipCode:</label></td><td><input type="text" size=15  id="Zipcode"  name="Zipcode"  value="<?php echo Util::getSessionValuebySessionName("phonePorting", "Zipcode"); ?>" ></td>
</tr>
</table>
因此,当我在下拉列表中进行选择时,如果会话值在html内容中不是空的,那么我要做的就是加载会话值(在文本字段中)。希望它有意义


谢谢。

问题已解决。我忘记在构造函数中启动会话

    public static function getSessionValuebySessionName($ssessionName, $keyName){

    if(!empty($_SESSION[$ssessionName][session_id()][0][$keyName]))
    {
        return $_SESSION[$ssessionName][session_id()][0][$keyName];
    }