SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast pyro.699's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [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:
    PHP Code:
    <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

  2. #2
    Forums Designer
    Join Date
    Jun 2004
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  3. #3
    SitePoint Enthusiast Boxer's Avatar
    Join Date
    Jan 2008
    Location
    Denver, Colorado
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not make a regular <form> and submit() it by the link? The form-accepting script can then print a new Location: header.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •