1 回答
TA贡献1859条经验 获得超6个赞
您返回的不仅仅是您想要的 jsonsearch.php
尝试删除这些行:
echo $selectSQL;
echo "<p></p>";
echo "<p></p>";
对于前端的 json 输出:您的 js 文件中有 2 个 ajax 调用,第一个将 json 与类一起放入 divmessage_box
结果不变:结果来自第二个 ajax 调用,它不会发送您的表单数据。
尝试将您的 js 更改为:
$(document).ready(function() {
var delay = 1000;
// Campaign Submit Info
$('[name="search_submit"]').click(function(e) {
e.preventDefault();
var lead_status = $('#filterformpost').find('#lead_status_select option:selected').val();
var campaign_status = $('#filterformpost').find('#campaign_status_select option:selected').val();
var company_name = $('#filterformpost').find('#company_name_select option:selected').val();
var tech_area = $('#filterformpost').find('#tech_area_select option:selected').val();
var firm_size = $('#filterformpost').find('#firm_size_select option:selected').val();
var firm_type = $('#filterformpost').find('#firm_type_select option:selected').val();
var country_name = $('#filterformpost').find('#country_name_select option:selected').val();
var state_name = $('#filterformpost').find('#state_name_select option:selected').val();
var start_date = $('#filterformpost').find('#start_date_search').val();
var end_date = $('#filterformpost').find('#end_date_search').val();
console.log(lead_status)
console.log(campaign_status)
console.log(company_name)
console.log(tech_area)
console.log(firm_size)
console.log(firm_type)
console.log(country_name)
console.log(state_name)
console.log(start_date)
console.log(end_date)
$.ajax({
type: "POST",
// url: "https://tribalyze.com/CRM/server/login.php",
url: "search.php",
data: {
"lead_status": lead_status,
"campaign_status": campaign_status,
"company_name": company_name,
"tech_area": tech_area,
"firm_size": firm_size,
"firm_type": firm_type,
"country_name": country_name,
"state_name": state_name,
"start_date": start_date,
"end_date": end_date
},
beforeSend: function() {
$('.message_box').html(
'<img src="tenor.gif" width="40" height="40"/>'
);
},
success: function(data) {
var result = $.parseJSON(data);
var string = '<table><thead><th>#</th><th>Lead ID</th><th>Name</th><th>Company</th><th>Location</th><th>Communication</th><th>Last Contact Date</th><th>Next Contact Date</th><th>Lead Status</th><th>Details</th></thead><tbody>';
/* from result create a string of data and append to the div */
var i = 1;
$.each(result, function(key, value) {
string += "<tr><td>" + i + "</td><td>" + value['Lead_Id'] + "</td><td>" + value['FirstName'] + ' ' + value['LastName'] + "</td><td>" + value['Company'] + "</td><td>" + value['State'] + '\n' + value['Country'] + "</td><td>" + value['Phone'] + '\n' + value['Email'] + "</td><td>" + value['LastContactDate'] + "</td><td>" + value['NextContactDate'] + "</td><td>" + value['LeadStatus'] + "</td><td><a href='#'>Click Here</a></td></tr>";
i = i + 1;
});
string += '</tbody></table>';
$("#filterRecords").html(string);
$('.message_box').html('');
}
});
});
});
- 1 回答
- 0 关注
- 187 浏览
添加回答
举报