我正在使用JQuery Mobile创建移动应用程序,我在这个html页面中有index.html我有2个页面(search_form,search_result)。我想从search_form页面提交搜索表单,然后它应该显示search_result页面。以下是我的js代码:
var formURL = "http://10.0.2.2/jobs/mobile/home/searchJobs/";
$.ajax(
{
url : formURL,
type: "POST",
data : $("#search_frm").serialize(),
//data : "&data=90",
beforeSend: function() {
showLoader();
},
success:function(result)
{
var list = '';
var data = $.parseJSON(result);
//$("#ulListview1").html($.parseJSON(result));
$.each(data,function(i,item){
if(item.id=='0')
{
list += "<li><span style='color:red;'>Record not found!</span></li>";
}
else
{
list += "<li><a data-transition='slide' href='#job_details_page' onclick='getJobDetails("+item.id+");'>" + item.job_title +"<p style='display:inline;'> at "+item.company+"</p><br><p><span><strong>Expiring On:</strong> "+item.expire_date+"</span> <br><span><strong>Job Location:</strong> "+item.location+"</span></p>"+"</a></li>";
}
//alert(data[i]["id"] + " " + data[i]["username"]);
});
//hide loader
hideLoader();
$("#search_list").html(list);
$("#search_list").listview("refresh");
$("#search_result").css("display","block");
},
error: function(jqXHR,status)
{
alert(status);
//alert($.parseJSON(jqXHR));
}
});
你能帮忙解决这个问题吗?