質問

I'm combining all my html pages to one page by setting those pages into divs because I'm making mobile app by Jquery mobile There's one problem in converting process. By normal, by using multiple html pages, I can send parameter via URL to another page. Like this

$('#allList').append('<li><a href="deadlineDetail.html?id='+allDeadline.id+'" data-transition = "slide >'+ allDeadline.class +'<br>'+ allDeadline.duedate+'  '+ allDeadline.duetime+'<br>'+ allDeadline.description +'</a></li>');

However, now I'm moving the deadlineDetail.html page into a div with id = "deadlineDetail"

So I'm gonna use this code

 $('#allList').append('<li><a href="#deadlineDetail?id='+allDeadline.id+'" data-transition = "slide >'+ allDeadline.class +'<br>'+ allDeadline.duedate+'  '+ allDeadline.duetime+'<br>'+ allDeadline.description +'</a></li>');

But so terrible that it cannot transfer the parameter via URL. Is there anyway to make it work ?

役に立ちましたか?

解決 2

You need to append that link just as link with no parameters, then you need to create a click function with the parameters like:

$('#allList').append('<li><a id="SOME_ID">'+ allDeadline.class +'<br>'+ allDeadline.duedate+'  '+ allDeadline.duetime+'<br>'+ allDeadline.description +'</a></li>');

$(document).on("click", "#SOME_ID", function(){
  // do your stuff with parameters
});

他のヒント

Make the hash the last part of your href.

href="?id='+allDeadline.id+'#deadlineDetail"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top