Witam.
Zrobiłem przycisk:
  1. <button class="edit_button" name="edit" value="test">edit</button>


I chciałbym, żeby po kliknięciu go redirectowało mnie na stronę z pewnym postem. Robię tak:
  1. $(".edit_button").click(function(){
  2. $.post({name: "John"});
  3. window.location.href = '/learning/edit_category';
  4. return false;
  5. });


Ale niestety po redirecie $_POST jest pusty. Ktoś może pomóc??

Edit:
złe moje podejście. Problem rozwiązany z:
  1. $(".edit_button").click(function(){
  2. var form= document.createElement('form');
  3. form.method= 'post';
  4. form.action = '/learning/edit_category';
  5. var input= document.createElement('input');
  6. input.type= 'hidden';
  7. input.name= 'test';
  8. input.value= '111';
  9. form.appendChild(input);
  10. document.body.appendChild(form);
  11. form.submit();
  12. return false;
  13. });