I recently posted a really dumb question about why my dropdown list wouldn't populate in a phonegap JQuery App I was doing - I am so new to this I didn't realise that phonegap doesn't run php scripts!! Ok so I went away and did some proper research, stored my php script on a server and linked to it via AJAX and hey presto - Database connection, dropdown filled happy days!!
My next problem is that I want the user to select a customer from the newly populated drop down and when they click on the option - to be redirected to a page that draws information about the customer from my database.
Here is my code for populating the list which works absolutely fine.
$(document).ready(function(){
var url= "xx";
$.getJSON(url,function(json){
$.each(json.members,function(i,dat){
$("#msg").append("<option>" + dat.Name + "</option>");
});
});
});
Can I put some code into the option tag which will allow me to open a new page, set the customers account number as a variable and draw their details from my database?
I tried
$("#msg").append("<option value='dat.AcNo'>" + dat.Name + "</option>");
(The dat.AcNo is the retrieved account number) but when I put an onclick() linking to the next page nothing happens. I guess this is pretty elementary, but i'm not doing something right - help.......please?!
On clicking the option, the page gets redirected to a page customerDetails.html