aneeb Posted April 16, 2013 Share Posted April 16, 2013 (edited) Hey Everyone! i am writing a code in which i am creating multiple <li> and i have given every <li> a different href. When i am running it and when i click on the href it is add the link in the current URL. Like this... <li><a href="promotiondetails.html?id=' + employee.id + '">Some Data</a></li> The current URL is like.. http://localhost/mano/www/promotions.html and this happens when i click on the <li>... http://localhost/mano/www/promotions.html#/mano/www/promotiondetails.html?id=275 I don't know whats going wrong. Please help me.... Edited April 16, 2013 by aneeb Link to comment Share on other sites More sharing options...
justsomeguy Posted April 16, 2013 Share Posted April 16, 2013 That wouldn't happen like you describe it, something is missing. Link to comment Share on other sites More sharing options...
aneeb Posted April 16, 2013 Author Share Posted April 16, 2013 (edited) I have written a javascript which gets the data in JSON format and appends that data into multiple <li>Here is the code which i have written... $('#employeeList').append('<li><a href="promotiondetails.html?id=' + employee.id + '">' + '<h4>' + employee.brand + ' - ' + employee.code + ' - '+ employee.subcode + '</h4>' + '<p>' + employee.details + '</p>' + '<p>' + employee.address + '</p>' + '</a></li>'); Edited April 16, 2013 by aneeb Link to comment Share on other sites More sharing options...
justsomeguy Posted April 16, 2013 Share Posted April 16, 2013 Are you attaching any click events to those elements? Link to comment Share on other sites More sharing options...
aneeb Posted April 17, 2013 Author Share Posted April 17, 2013 Here is the complete JavaScript which i have written. var serviceURL = "http:/localhost/mano/services/";var employees;$('#employeeListPage').bind('pageinit', function(event) {getPromotionList();});function getPromotionList() {//var id = getUrlVars()["id"];var urlVars = getUrlVars();var urlId = '';var urlUserno = '';var urlBrand = '';if (urlVars['id'] != undefined){ urlId = urlVars['id']; var get = ''; get = 'getpromotions.php?id='+urlId; }else if (urlVars['userno'] != undefined){ urlUserno = urlVars['userno']; var get = ''; get = 'getpromotions.php?userno='+urlUserno; }else if (urlVars['brand'] != undefined){ urlBrand = urlVars['brand']; var get = ''; get = 'getpromotions.php?brand='+urlBrand; } else{ var get = ''; get = 'getpromotions.php'; } $.getJSON("http://localhost/mano/services/" + get , function(data) { $('#employeeList li').remove(); employees = data.items; $.each(employees, function(index, employee) { var url = 'promotiondetails.html?id=' + employee.id; /*alert(url);*/ $('#employeeList').append('<li><a href="promotiondetails.html?id=' + employee.id + '">' + '<h4>' + employee.brand + ' - ' + employee.code + ' - '+ employee.subcode + '</h4>' + '<p>' + employee.details + '</p>' + '<p>' + employee.address + '</p>' + '</a></li>'); }); $('#employeeList').listview('refresh');});} Link to comment Share on other sites More sharing options...
justsomeguy Posted April 17, 2013 Share Posted April 17, 2013 Do you have an example of that online? The listview method might be doing something to the list that would cause that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now