Jump to content

HREF having problem


aneeb

Recommended Posts

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 by aneeb
Link to comment
Share on other sites

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 by aneeb
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...