I want to add some infos to a database. If the database has already some info, you may not add some infos.
$(document).on("pagecreate", "#RDpage",function(){
$("#submitR").click(function() {
$.getJSON("http://xxx:8080/getRD", function(data) {
if (data.length == 0) {
// send data to server
$.ajax({
url: "http://xxx:8080/addRD",
type: 'GET',
contenttype:'application/json; charset=utf-8',
data: {
user:user,
RD:"Test"
},
dataType:'JSON'
});
$.mobile.changePage("#dialogAddRD", { transition: "pop", role: "dialog" });
} else {
$.mobile.changePage("#dialogExistingRD", { transition: "pop", role: "dialog" });
}
});
})
});
Actually it works, BUT not the redirect.
I click on the button, it sends the data to the server and the dialogAddRD appears for 1 second. I can't click on it. Then I will be redirected back to the RDpage.
Normally, the dialog should remains open and then, I can click a button to go to another page