0

i asked this question before but still my problem has not been solved.let me explain my problem again .i have one recommend.html page havving differnt button choose merchant,choose contact choose product.in choose merchant i have one textbox havving id =merchant near to it.after clicking on choose merchant it will go to the brand.html and will give me the list of merchant.after cliking on one of the list item i am getting the value of this merchant in variable text and now want to append this value to the textbox of recommend.html.this is the code i tried but not working .. this is from brand.js

 $('.ui-li-icon li').click(function() {
        var index = $(this).index();
        var text = $(this).text();
        alert('Index is: ' + index + ' and text is ' + text);
         sessionStorage.setItem("selectedMerchant", text);

         window.location="recommendmanual.html"; 

          $('#merchant').append(text);  
    });

this is recommend.js

function load()
              {
              var selectedMerchant = "";
              if ( sessionStorage.getItem("selectedMerchant") ) {
              selectedMerchant = sessionStorage.getItem("selectedMerchant");
             alert(selectedMerchant);
              }
              }

and recommend.html is

<input type="text" id="merchant"></input>
user3415421
  • 215
  • 1
  • 2
  • 13

2 Answers2

1

You need to set the value of the #merchant in your recommend.js

function load()
{
     var selectedMerchant = "";
      if ( sessionStorage.getItem("selectedMerchant") ) {
          selectedMerchant = sessionStorage.getItem("selectedMerchant");
          $("#merchant").val(selectedMerchant);
      }
}
Navin
  • 594
  • 2
  • 11
0

Why don't you have both on the same page? using jquery you can show and hide sections of the webpage, where one section could handle brand and one merchand.

If you absolutely want to have this on two pages, I believe you could set parameters in the url. i found something here, see if it is anything you could use: Adding a parameter to the URL with JavaScript.

Community
  • 1
  • 1
confuse
  • 220
  • 2
  • 7