Zrobiłem przycisk:
I chciałbym, żeby po kliknięciu go redirectowało mnie na stronę z pewnym postem. Robię tak:
$(".edit_button").click(function(){ $.post({name: "John"}); window.location.href = '/learning/edit_category'; return false; });
Ale niestety po redirecie $_POST jest pusty. Ktoś może pomóc??
Edit:
złe moje podejście. Problem rozwiązany z:
$(".edit_button").click(function(){ var form= document.createElement('form'); form.method= 'post'; form.action = '/learning/edit_category'; var input= document.createElement('input'); input.type= 'hidden'; input.name= 'test'; input.value= '111'; form.appendChild(input); document.body.appendChild(form); form.submit(); return false; });