做带字头像的网站,温州seo博客,广西电网公司建设年鉴,如何删除错误wordpress我想将一条消息保存在PHP变量中#xff0c;并用已返回的其他数组变量发回。例如#xff0c;我在PHP代码中发生了一些错误检查#xff0c;并想要一个字符串变量#xff0c;并将特定的消息发送回我的javascript中使用。将字符串变量从PHP发送回数组变量的ajax ...#xff1f…我想将一条消息保存在PHP变量中并用已返回的其他数组变量发回。例如我在PHP代码中发生了一些错误检查并想要一个字符串变量并将特定的消息发送回我的javascript中使用。将字符串变量从PHP发送回数组变量的ajax ...这里是PHPinclude(config-searchres.php);$term $_POST[resid];$sql mysql_query(SELECT * FROM ap_form_8 WHERE id $term); //select first name (element_1_1) from form #8if ($row mysql_fetch_array($sql)){ //if reservation number existsif ($row[element_11] ! Cancelled){ //if reservation has not already been cancelledif (strtotime($row[element_3]) strtotime(date(Y-m-d))){ //if reservation has not already passed dateecho json_encode($row);}else //Reservation already passed (old reservation){echo passed;}}else //Reservation already cancelled{echo cancelled;}}else //Reservation not found{echo not found;}mysql_close();?正如你可以看到有3级不同的消息“合格”“取消”和“未找到” ......如果这些条件之一存在我想把这个字符串发回给我的JavaScript所以我可以在DIV中显示它。不过我也想发送$ row数据。我的javascript$(document).ready(function(){resetForms(reservation);$(#form-reservation).submit(function(event){event.preventDefault(); //the page will no longer refresh on form submit.var resCheck $(this).find(input[classreservationid]).val(); //now we have the reservation ID, lets perform our check.$.ajax({url: inc/searchres.php,type: POST,data: residresCheck,success: function(data){ //data is all the info being returned from the php file$(#reservation-id).val(resCheck); //add read ID back into text boxvar jsonData $.parseJSON(data); //parse returned JSON data so we can use it like data.name, data.whatever//****I wanted the line just below this to display the appropriate message sent back from the PHP****$(#res-message).html(Reservation ID Located, Information is displayed below);$(#json-reservation).populate({personal_first_name:jsonData[element_1_1],personal_last_name:jsonData[element_1_2],personal_phone_1:jsonData[element_7],personal_email:jsonData[element_2],reservation_status:jsonData[ADD THIS CELL], reservation_id:jsonData[id], reservation_date:jsonData[element_3],reservation_time:jsonData[element_4],reservation_party:jsonData[element_5],reservation_special_request:jsonData[element_6],reservation_using_coupon:jsonData[element_9],reservation_coupon_code:jsonData[element_10],reservation_status:jsonData[element_11]});$(#res-cancel-message).html();},error: function(){$(#res-message).html(There was an error with your request);$(#res-cancel-message).html();}});});});我打上我填充在这个时候一个静态的消息DIV星号这是我会填充从PHP消息的线。有任何想法吗2012-04-26tmparisi