html5 - how to link a button to a page using jquery provided that onclick triggers some other function too -


i want showall button click should open page , showall function gets executed there results printed on new page.secondly how can modify console.log statement other prints result on this(new)page , not on console.

html

<ul class="nav">     <li id="add" ><p>add</p></li>     <li id="show"><p>show</p></li>     <li id="showall"><p>show all</p></li>  </ul> 

js file

$(document).ready(function(){     function showall()     {         var objectstore = db.transaction(storename).objectstore(storename);          objectstore.opencursor().onsuccess = function(event)         {             var cursor = event.target.result;             if (cursor)              {             console.log(" post: " + cursor.value.post);                 cursor.continue();             }             else             {                 alert("no more entries!");             }         };      }             $("#showall").click(function()       {              console.log("eventlistner called showall...");              showall();        });  }); 

you have more specific mean "the new page". pass data between 2 different pages, can either:

  • make post/get request, along data
  • store data in session variable, ajax-call back-end script
  • store in temporarily cookie
  • use html5 localstorage api

Comments