php - jQuery post without a form but with page refresh -


is possible submit post data php script using jquery, without form on page , page refresh?

redirection

$(document).ready(function(){     $('.button').click(function(){         window.location.replace('index.php?some_value=1');     }); }); 

in example data sent, how can send post data redirection?

post

$(document).ready(function(){     $('.button').click(function(){         $.post(             'index.php',             {                 some_value: '1'             }, function(result) {                 alert(result);             }         );     }); }); 

this example not refresh page.

you make form hidden have data within form , "submit it" yourself.

if include

style="display:none" 

in form this

<form style="display:none" action="post">     <input field input field>     <input maybe input field> </form> 

then can still submit things via post not have show


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -