0
我有一個正常工作在正常jquery移動頁面的ajax表單,但是當我在對話框上轉移它時不起作用。我的腳本沒有讀取設置了w/c的點擊事件,並且默認情況下它發送的是同一頁上的所有值,這是錯誤的。我錯過了什麼嗎?任何想法?提前致謝。jquery mobile ajax從對話框提交
值被髮送到這個網址這是錯誤的:的
http://localhost/MyFolder/views/maintenance/RegionAdd.html?triggerActivity=region&triggerAction=add®ionDesc=test&area=test222
代替:
http://localhost/MyFolder/model/maintenance/maintenance_process.php?triggerActivity=region&triggerAction=add®ionDesc=test&area=test222
請參閱下面的腳本。
JS:(位於RegionAdd.html)
$(document).bind("pageinit", function(){
$("#submit-region").click(function(){
//var regionDesc = $("#regionDesc").val();
//console.log(regionDesc);
var formData = $("#ajaxForm").serialize();
$.ajax({
type: "GET",
url: "../../model/maintenance_process.php",
cache: false,
data: formData,
success: onSuccess
});
//e.preventDefault();
});
});
HTML5:(位於RegionAdd.html)
<body>
<div data-role="page">
<form id='ajaxForm'>
<div data-role="header">
<h1>Add Region</h1>
<button type='submit' data-theme="a" data-icon="check" data-mini="true" id="submit-region">Save</button>
</div><!-- /header -->
<div data-role="content">
<div class="content-primary">
<input type="hidden" name="triggerActivity" id="triggerActivity" value="region" />
<input type="hidden" name="triggerAction" id="triggerAction" value="add" />
<ul data-role="listview">
<li data-role="fieldcontain">
<label for="regionDesc">Region</label>
<input type="text" name="regionDesc" id="regionDesc" value="" />
</li>
<li data-role="fieldcontain">
<label for="area">Area</label>
<input type="text" name="area" id="area" value="" />
</li>
</ul>
<h4 id="message"></h4>
</div>
</div><!-- /content -->
</form>
</div><!-- /page -->