我想使用jquery ajax提交表单并更新它。它可以很好地处理少量数据,但是当我有更多数据时会窒息。这种方法有固有的限制,还是我在这里进行疯狂的追逐?
这是我的保存功能
function customSave(){
var page = document.getElementById("page").value;
var companyid = document.getElementById("companyid").value;
var formdata = $('#mainform').serialize();
$.ajax({
url: 'transactionsbin-update.php',
method: 'POST',
data: formdata,
success: function() {
reloadList(companyid,page);
},
error: function(){
alert("Save failed");
}
});
}
我正在更新的页面是根据用户指定的条件从数据库中选择的财务交易列表。因此,根据用户输入的搜索条件,交易清单可能很长或很短。每笔交易都有7到10个输入,具体取决于交易类型,而且我提交的表格中还有许多其他输入。
基本上我注意到的是,如果我有一些交易(例如3个)似乎没有任何问题,但如果我有一个完整的交易页面(例如26),它就会失败。
我知道这是因为我正在查看Chrome的开发者工具,网络标签,如果我点击更新页面网址,则会显示404错误。顺便说一句,它也会显示一个GET方法,即使我在我的ajax调用中明确指定了POST。
以下网址失败。它长11,234个字符。
https://timesavr.net/dev/transactionsbin-update.php?searchinput=&fromdate=2014-03-01&todate=2014-03-11&activefamiliescbx=on&inactivefamiliescbx=on&chargescbx=on&paymentscbx=on&debitcbx=on&creditcbx=on&chequecbx=on&cashcbx=on&moneyordercbx=on&bankdraftcbx=on&eftcbx=on&paypalcbx=on&emailcbx=on&tdcbx=on&nontdcbx=on&familyid%5B%5D=265&transactiontype%5B%5D=C&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=10&transactionid%5B%5D=133033&transactionreference%5B%5D=0527&listchargeitems%5B%5D=34&listtransactionamount%5B%5D=25&transactionpaymenttype%5B%5D=&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayer%5B%5D=M&familyid%5B%5D=9740731&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=08&transactionid%5B%5D=133031&transactionreference%5B%5D=106&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=-2.00&transactionpaymenttype%5B%5D=MNY&transactiontaxdeductible%5B%5D=N&transactionhistorycomment%5B%5D=Reimbursement+stuff&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=55&transactiontype%5B%5D=C&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=07&transactionid%5B%5D=133032&transactionreference%5B%5D=0526&listchargeitems%5B%5D=34&listtransactionamount%5B%5D=25.00&transactionpaymenttype%5B%5D=&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayer%5B%5D=M&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133016&transactionreference%5B%5D=21&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=545.00&transactionpaymenttype%5B%5D=BNK&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Stuff+in+IE&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133001&transactionreference%5B%5D=125&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=777.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9732415&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133002&transactionreference%5B%5D=102&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=888.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133003&transactionreference%5B%5D=444&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=444.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9732415&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133004&transactionreference%5B%5D=555&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=555.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Father&transactionpayer%5B%5D=F&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133007&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=345.00&transactionpaymenttype%5B%5D=BNK&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9730051&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133000&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=650.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Testing&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133006&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=345.00&transactionpaymenttype%5B%5D=CSH&transactiontaxdeductible%5B%5D=N&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133005&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=654.00&transactionpaymenttype%5B%5D=DBT&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9732415&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=132999&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=550.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Testing&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9730051&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133009&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=345.00&transactionpaymenttype%5B%5D=BNK&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=132998&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=450.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Testing&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9730051&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=132994&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=88.00&transactionpaymenttype%5B%5D=MNY&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=asdfdddd&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9732415&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=132996&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=55.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=ddreee&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9732415&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=132993&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=855.00&transactionpaymenttype%5B%5D=MNY&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=asdfdddd&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=132992&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=350.00&transactionpaymenttype%5B%5D=MNY&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=asdfdddd&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9732415&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133008&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=345.00&transactionpaymenttype%5B%5D=BNK&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayerlabel%5B%5D=Father&transactionpayer%5B%5D=F&familyid%5B%5D=9730051&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=132997&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=66.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=ddreee&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=132995&transactionreference%5B%5D=&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=22.00&transactionpaymenttype%5B%5D=CHQ&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=ddreee&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9730051&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133018&transactionreference%5B%5D=15&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=887.00&transactionpaymenttype%5B%5D=BNK&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Stuff+in+IE&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9732415&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=06&transactionid%5B%5D=133017&transactionreference%5B%5D=2&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=877.00&transactionpaymenttype%5B%5D=BNK&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Stuff+in+IE&transactionpayerlabel%5B%5D=Father&transactionpayer%5B%5D=F&familyid%5B%5D=265&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=04&transactionid%5B%5D=133019&transactionreference%5B%5D=654425&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=12.00&transactionpaymenttype%5B%5D=EFT&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Testing+FireFox+Now&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=9732415&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=04&transactionid%5B%5D=133020&transactionreference%5B%5D=54&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=45.00&transactionpaymenttype%5B%5D=EFT&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Testing+FireFox+Now&transactionpayerlabel%5B%5D=Father&transactionpayer%5B%5D=F&familyid%5B%5D=9730051&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=04&transactionid%5B%5D=133021&transactionreference%5B%5D=556&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=12%2C211.00&transactionpaymenttype%5B%5D=EFT&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=Testing+FireFox+Now&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&submittoken=&submitaction=¤ttime24=10%3A46&mm_noteentitytype=&mm_noteentityid=&mm_noteidtodelete=&_=1394556415701
这个提出没有问题的地方。它长1,566个字符。
https://timesavr.net/dev/transactionsbin-update.php?searchinput=&fromdate=2014-03-07&todate=2014-03-11&activefamiliescbx=on&inactivefamiliescbx=on&chargescbx=on&paymentscbx=on&debitcbx=on&creditcbx=on&chequecbx=on&cashcbx=on&moneyordercbx=on&bankdraftcbx=on&eftcbx=on&paypalcbx=on&emailcbx=on&tdcbx=on&nontdcbx=on&familyid%5B%5D=265&transactiontype%5B%5D=C&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=10&transactionid%5B%5D=133033&transactionreference%5B%5D=0527&listchargeitems%5B%5D=34&listtransactionamount%5B%5D=25&transactionpaymenttype%5B%5D=&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayer%5B%5D=M&familyid%5B%5D=9740731&transactiontype%5B%5D=P&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=08&transactionid%5B%5D=133031&transactionreference%5B%5D=106&listchargeitems%5B%5D=0&listtransactionamount%5B%5D=-2.00&transactionpaymenttype%5B%5D=MNY&transactiontaxdeductible%5B%5D=N&transactionhistorycomment%5B%5D=Reimbursement+stuff&transactionpayerlabel%5B%5D=Mother&transactionpayer%5B%5D=M&familyid%5B%5D=55&transactiontype%5B%5D=C&transactionyear%5B%5D=2014&transactionmonth%5B%5D=03&transactionday%5B%5D=07&transactionid%5B%5D=133032&transactionreference%5B%5D=0526&listchargeitems%5B%5D=34&listtransactionamount%5B%5D=25.00&transactionpaymenttype%5B%5D=&transactiontaxdeductible%5B%5D=Y&transactionhistorycomment%5B%5D=&transactionpayer%5B%5D=M&submittoken=&submitaction=¤ttime24=10%3A54&mm_noteentitytype=&mm_noteentityid=&mm_noteidtodelete=&_=1394556855187
我知道大多数浏览器对查询字符串长度有限制(我使用Chrome进行测试)但我也读过使用方法:jquery中的POST ajax应该像POST而不是GET而真正的POST不提交查询字符串上的任何内容,尽管jquery似乎。所以我想我的问题的第二部分是,在jquery ajax调用中使用POST和GET之间有什么区别呢?