[jQuery] window.location && submit Post Data

Hey,

I was wondering how you go about using a simple link, clicking on it, submitting post data, but unlike ajax it would change the browser location aswell.

Example:


<script type="text/javascript">
$(document).ready(function(){
    $("a[name='edit']").click(function(){
        var data = {
name: "Their Name, gotten through other methods",
nextvar: "Other data"
};
    });
});
</script>

<a href="#" name="edit">Edit</a>

After clicking on edit, it would then navigate to a specified url and send the post data so that they would be able to edit the info.

I would do this with a simple form if there was not 1 problem. These edit links are all generated, meaning there could be several on one page and it would be difficult to manage them that way.

Thanks
~Cody Woolaver

I’m not sure what you are trying to do here.

If you want url to be different than one of submitted form, you can use ajax to submit your form, then on success event change document.location.href

Why not make a regular <form> and submit() it by the link? The form-accepting script can then print a new Location: header.