Simple jQuery Plugin For POST Or GET Redirection - redirect

File Size: 71 KB
Views Total: 17535
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Simple jQuery Plugin For POST Or GET Redirection - redirect

redirect is a jQuery plugin that allows to redirect the current page with nested objects and arrays to another URL via either Post or Get methods.

How to use it:

1. To use this plugin, you first have to load the jQuery redirect plugin's script after jQuery library as this:

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jquery.redirect.js"></script>

2. The JavaScript to redirect the page to another via default POST method.

$.redirect("/path/to/post.php",
  {
    user: "johnDoe",
    password: "12345",
    submit: "name"
  },
  "POST", "_blank");

3. All default parameters for the redirect function.

  • url - Url of the redirection
  • values - (optional) An object with the data to send. If not present will look for values as QueryString in the target url.
  • method - (optional) The HTTP verb can be GET or POST (defaults to POST)
  • target - (optional) The target of the form. "_blank" will open the url in a new window.
$.redirect = function (url, values, method, target)

Changelog:

2022-11-22

  • v1.2.0: clean up

2021-03-17

  • v1.1.4: Updated package

2018-05-30

  • v1.1.4: Delete form after submit, update docs and fix spdx license

2017-07-25

  • Add support for frames

2017-06-01

  • Fixed issues with POSTing an array of objects

2017-05-17

  • v1.0.5

2016-06-11

  • Fix for GET method

This awesome jQuery plugin is developed by mgalante. For more Advanced Usages, please check the demo page or visit the official website.