Jump to content
Sign in to follow this  
aneeb

HREF having problem

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

Share this post


Link to post
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

Share this post


Link to post
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');});}

Share this post


Link to post
Share on other sites

Do you have an example of that online? The listview method might be doing something to the list that would cause that.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...