1
jQueryを使用してフォームの値を取得し、AJAX POST呼び出しを行い、その値を.phpファイルにポストします。このファイルはdbに値を処理します。jQueryがこの値を取得しないのはなぜですか?
私は値を得た場合alert()
でテストしようとするたびに、すべてが株式価値を除いて動作します...私は私が間違ってやっているものを見つけることができません。..
のjQuery:
var title = $("#title").val();
var text = $("#text").val();
var summary = $("#description").val();
var keywords = $("#keywords").val();
var price = $("#price").val();
var stock = $("#stock").val();
var brand = $("#brand").val();
var product = product;
alert(title);
alert(stock);
形式:
<form class="form-horizontal form-inline">
<div class="form-group">
<label class="control-label col-sm-3" for="title">Product:</label>
<input type="text" class="form-control" id="title" name="title" placeholder="Enter new title">
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="price">Price:</label>
<input type="text" class="form-control" id="price" name="price" placeholder="Enter new price">
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="stock">Stock:</label>
<input type="text" class="form-control" id="stock" name="stock" placeholder="Enter new stock">
</div>
<div class='form-group'>
<label class="control-label col-sm-3" for="text">Text:</label>
<textarea class='form-control' rows='5' id='text' name='text' placeholder='Enter new text'></textarea>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="description">Description:</label>
<input type="text" class="form-control" id="description" name="description" placeholder="Enter new description">
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="brand">Brand:</label>
<input type="text" class="form-control" id="brand" name="brand" placeholder="Enter new brand">
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="keywords">Keywords:</label>
<input type="text" class="form-control" id="keywords" name="keywords" placeholder="Enter new keywords">
</div>
<a href="#" id="updateProductRecord" pid="<?php echo $pro_id; ?>"><button type="submit" id="submitUpdateProduct" class="btn btn-default">Submit</button></a>
</form>
..あなたは、PHP/AJAXから値を取得していないと思いますか?または – Jagadeesh
nvmがそれを修正したことを理解するためのフィドルを追加してください。 –