0
我想通過Ajax檢索從jquery到php的數據。阿賈克斯的反應是越來越,但不張貼在PHP頁面
我的代碼,以便啓動一個模態窗口
<a href='javascript:void(0):' data-id={$row['customer_id']} class='btn small bg-blue-alt tooltip-button modal-customeredit' data-placement='top' title='Edit'><i class='glyph-icon icon-edit' ></i>
這裏是從主page.and打開一個模式彈出越來越ID。 模態腳本如下。
$(".modal-customeredit").click(function() {
var myGroupId = $(this).attr('data-id'); // data-id
data = {'id':myGroupId };
$.ajax({
type: "POST",
url: "left.inc.php",
data: data, // data retrieve on server-side ($_POST['id'])
success:function(response){
$("#modal-customeredit").dialog({
modal: true,
minWidth: 700,
minHeight: 200,
dialogClass: "modal-dialog",
show: "fadeIn"
});
alert('done');
alert(response); //do the rest of operations.
}
});
my form code is for modal:
<!-- Customer Edit -->
<div class="hide" id="modal-customeredit" title="Edit Customer Info">
<div class="pad10A">
<h3>Update Customer Info</h3>
<p class="font-gray-dark"> Fides Admin uses colors & styles from both the default theme color schemes and the included core color helpers. </p>
<div class="divider"></div>
<form id="customer-edit" action="" class="col-md-12 center-margin" method="">
<div class="form-row">
<div class="form-label col-md-3">
<label for="name">
Name:
<span class="required">*</span>
</label>
</div>
<div class="form-input col-md-9">
<input id="name" name="name" placeholder="Name" data-required="true" class="parsley-validated" type="text">
</div>
</div>
<div class="form-row">
<div class="form-label col-md-3">
<label for="details">
Details :
<span class="required">*</span>
</label>
</div>
<div class="form-input col-md-9">
<input id="details" placeholder="Details" name="details" data-required="true" class="parsley-validated" type="text">
</div>
</div>
<div class="form-row">
<div class="form-label col-md-3">
<label for="domain">
Domain :
<span class="required">*</span>
</label>
</div>
<div class="form-input col-md-9">
<input id="domain" placeholder="Domain" name="domain" data-required="true" class="parsley-validated" type="text">
</div>
</div>
<div class="form-row">
<div class="form-label col-md-3">
<label for="vertical">
Vertical :
<span class="required">*</span>
</label>
</div>
<div class="form-input col-md-9">
<input id="vertical" placeholder="Vertical" name="vertical" data-required="true" class="parsley-validated" type="text">
</div>
</div>
<div class="form-row">
<div class="form-label col-md-3">
<label for="taxanomy">
Taxanomy :
<span class="required">*</span>
</label>
</div>
<div class="form-input col-md-9">
<input id="taxanomy" placeholder="Taxanomy" name="taxanomy" data-required="true" class="parsley-validated" type="text">
</div>
</div>
<div class="divider"></div>
<div class="form-row">
<div class="form-input col-md-8 col-md-offset-3">
<a href="javascript:;" class="btn medium primary-bg radius-all-4" id="customer-edit-valid" onclick="javascript:$('#customer-edit').parsley('validate');" title="Validate!"><span class="button-content">Submit</span></a>
</div>
</div>
</form>
</div>
</div>
<?php } elseif ($pfile=="customer-screen.php") { ?>
我面對的問題是我從ajax獲得響應,顯示我想要的確切ID。 但是,當我在php嘗試爲
<?php $id=$_POST['id'];
echo $id; ?>
我沒能呼應在PHP ID file.But在response.Hope AJAX顯示我正在輸送的問題properly.Ifü幫助將是非常讚賞如果你對我的問題有疑問,請發表評論讓我expalin。
我不明白這個問題。如果ajax在警報中顯示響應,那麼一切正常。 – Barmar
我假設最後的大括號和括號只是一個複製錯誤。 – Barmar
@barmar我沒有在php頁面獲得id變量 – user3386898