i have this for loop that generates labels for each data entry in the array? what i need to do now is write an if statement to check if a certain label is clicked because only that one id has more data in it to display in the next page, for the rest of the buttons i only want an alert to pop up saying there is no data available! following is the picture of the results and actual code!
PIC:

i only want purchase sundry’s label’s id to go to next page the rest should throw alert!
here is code:
$(document).ready(function() {
$.getJSON("http://41.134.206.60/wf7_api/api/inbox/johnny", function(data){
for(var i = 0; i < data.length; i++) {
var high = data[i].High;
var medium = data[i].Medium;
var low = data[i].Low;
var sum = high + medium + low;
$("#showdata").html("tasks");
$("#shownames").append("<label id="+ data[i].ProcessID +" onclick="+"redirectme();"+" style="+"text-align:center;"+"font-size:x-large;"+">"+ data[i].ProcessName +"</label><label style="+"font-size:x-large;"+">("+sum+")</label><labels class="+"lowpic"+" id="+"righty"+">"+low+"</labels><labels class="+"mediumpic"+" id="+"righty"+">"+medium+"</labels><labels class="+"highpic"+" id="+"righty"+">"+high+"</labels></br>");
};
} , 'json');
});
function redirectme(){
var r = document.getElementById("76");
window.location.href = "Datapage.html";
}
what currently is happening is every label is going to Datapage.hmtl, i only want the one label with a specific id to go to the datapage.html, the rest should throw an alert? how do i get this done? i am new to this!
using cordova/html5/javascript/jquery/visual studio 2010
thanks in advance
This whole section of code needs a rewrite but if you just need it to work then this is what you need to change:
And the handling function:
I’m happy to do a fiddle for you in a way that would be much easier to maintain and change if you’re interested just drop a comment below.