4

how to reload same page after change the select box option.

I have to used some shopping cart framework.In this i need to update cart price when i changed product attributes ,

so i need to reload the same page when the select box is onchanged.

<tr><td>
  <select name="color" onchange="">
   <option value="red"> Red </option>
<option value="red"> Blue</option>
<option value="red"> Green</option>
<option value="red"> Pink</option>
</select>
</td></tr>
2
  • without reloading the whole page..i believe you should use AJAX for this – swapnesh Jul 17 '13 at 12:05
  • Are you using any javascript Framework ? – Michael Laffargue Jul 17 '13 at 12:07
12

You can try this:

<tr>
  <td>
    <select name="color" onchange="location.reload()">
      <option value="red">Red </option>
      <option value="blue">Blue</option>
      <option value="green">Green</option>
      <option value="pink">Pink</option>
    </select>
  </td>
</tr>
1
(function($) {
    $(document).ready( function() {
        $('#name').change(function() {
            location.reload();
        });
    });
})(jQuery);
0
$('#something').change(function() {
    location.reload();
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.