Hi,
In my app I have a page with 2 dropdowns (the second one gets populated based on the selection in the first one) and a button. The button sets 2 local storage variables and then navigates to the page where the map is located. On page load on the map page, I set the property of 2 hidden labels on the page that reads from the local storage variables and then it fires a query service to collect data from the database. The query must fetch data based on the variables and it must match a column called province (no problems there) and a column called city. This is where the problem comes in. The value for city keeps giving me a "Bad Request" error.
Looking at the request this is what it sends through: where:{"Province": "Gauteng", "City": ""Pretoria0""}
This is the code for the query: return '{"Province": "' + localStorage.getItem("province") + '", "City": "' + localStorage.getItem("city") + '"}';
Please tell me where I'm going wrong here.
Oh, here is the code I use on the dropdowns:
var selectedValue = this.value;
var data = { 'Gauteng': ['Pretoria', 'Johannesburg'],
'Western Cape': ['Cape Town', 'George', 'Worcester'],
'Free State': ['Bloemfontein'],
'Limpopo': ['Polokwane'],
'Mpumalanga': ['Witbank'],
'Kwazulu-Natal': ['Durban'],
'North West': ['Rustenburg']
};
var dropDown = $('[name=citySelector]');
dropDown.html('');
var newData = data[selectedValue];
for(i = 0; i < newData.length; i++) {
dropDown.append('' + newData + '');
}
dropDown.selectmenu('refresh');