모바일 앱입니다. 나는 아약스는이 코드를 웹 서버로부터 데이터를 수신 호출을 사용완료 후 jquery ajax call once once 함수
$.ajax({
url: 'http://www.xxxxxxxxxxxx',
data: {name: 'Chad'},
dataType: 'jsonp',
success: function(data){
$.each(data.posts, function(i,post){
$.mobile.notesdb.transaction(function(t) {
t.executeSql('INSERT into bill (barcode, buildingcode, buildingaddress, flatname, flatdescription, entryseason, period, amount, pastpayments, todaypayments, receiptno) VALUES (?,?,?,?,?,?,?,?,?,?,?);',
[post.Id, post.Code, post.Address, post.Name, post.Description, post.EntrySeason, post.Period, post.Revenue, post.PastPayments, post.todaypayments, post.receiptno],
function(){
bill = 1;
$('#mycontent').append("bill - OK");
}
);
});
});
}
});
내가 bill - OK
SQLite는에 삽입 된 모든 데이터 후 한 번만 표시합니다.
$.ajax({
url: 'http://www.xxxxxxxxxxxx',
data: {name: 'Chad'},
dataType: 'jsonp',
async: false, //this line here
//...
편집 대해
확인 :
$.each(data.posts, function(i,post){
//rest of stuff
});
$('#mycontent').append("bill - OK"); //this line outside the each() call
을 그리고 실제 문제는 .. .? –
청구서 - sqlite 게시에 대한 모든 삽입물에 대해 표시되는 확인 ... 20 회 – kosbou
'$ .each'루프 외부로 'bill - OK'행 이동. – SenorAmor