0

I am passing some parameters from one page to another through session ,problem what I am facing is each parameters is getting reflected in the URL,which I think is not a correct way. So I want to remove all the parameters from the URL,while navigating to other page.

Please suggest me some way to archive so.

This is the URL what I am getting

http://localhost:58736/index.html#bankedit//10000422%20%20%20%20%20%20%20%20%20%20%20%20?PayeeId=4&BankName=State%20Bank%20%20

Code what I am using to navigate is:

cellTemplate: function (container, options) {$('<a/>').addClass('hyperlink')
       .text('Edit |')
       .on('click', function () {
            var Edit;
            Demo.app.navigate("bankedit/?AccountNumber=" + options.data.AccountNumber + "&PayeeId=" + options.data.PayeeId + "&BankName=" + options.data.BankName );  
            sessionStorage.setItem('AccountNumber', options.data.AccountNumber);
            sessionStorage.setItem('PayeeId', options.data.PayeeId);
            sessionStorage.setItem('BankName', options.data.BankName);
            sessionStorage.setItem('Type', "Edit");
      }).appendTo(container);

       $('<a/>').addClass('hyperlink')
           .text(' Delete')
           .on('click', function () {
                  options.component.removeRow(options.rowIndex);
           }).appendTo(container);
    }

And for retrieval of parameter values:

sessionStorage.getItem("BankName"), 

in bankedit.js page

TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188
vishal
  • 55
  • 6

2 Answers2

0

Sorry for delay. You can try history API to manipulate the URL shown in browser.

try following once loading is done:

var orig=document.location.href;
var noParam=urlWithoutParams.substring(0,urlWithoutParams.indexOf("#"));

history.replaceState({'Original':orig},'',noParam);

This will replace current href with one without any query string parameters. More information about history API is here at MDN docs

TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188
  • Thank you for the response,I tried to implement this,but it is not working. Can you please suggest me some other way to perform so like Post method or something. – vishal Jan 12 '16 at 05:32
  • Is this single page app? Are you moving to `bankedit` page or only a hash change (part after #) occurs? If you navigate to next page then you need to run this history stuff on that page. – TheVillageIdiot Jan 12 '16 at 07:53
0

Tkanks a lot for sharing your experience.I am able to solve it with session. I just replaced Demo.app.navigate("bankedit/?AccountNumber=" + options.data.AccountNumber + "&PayeeId=" + options.data.PayeeId + "&BankName=" + options.data.BankName ); with PaMobile01.app.navigate("bankinformationedit/");

And kept rest of my parameters in session

vishal
  • 55
  • 6