Skip to content
This repository has been archived by the owner. It is now read-only.
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

RestfulizerJs

_Native POST support and hidden "method" input support for PUT/DELETE

A simple jQuery plugin for changing the http method (POST/PUT/DELETE) of a simple html link or button.

How to use

1: Add the jquery.restfulizer.js file into your project including jQuery.

  <script type="text/javascript" src="js/jquery.restfulizer.js"></script>

2: Use the jQuery method restfulizer() on any link you want to customize the method :

<a href="/user/3" data-method="DELETE" class="rest">link</a>
$(".rest").restfulizer();

Advanced usage

You can also POST links with parameters (and also automatically setup the POST method) :

<a href="/user/create?name=John&age=18&email=test@test.com" class="rest-post">link</a>
$(".rest-post").restfulizer({
        parse: true,
        method: "POST"
});

Full options usage

$(".rest").restfulizer({
        parse: true, // Parse the URL parameters (allow to send them to POST)
        method: "PUT", // The method (POST is native but PUT and DELETE will be simulated with a hidden input called "_method", this solution is handled by many PHP frameworks)
        target: "example.html?specified=yes" // The target (usefull for making non link clickable)
});

About

A simple jQuery plugin for changing the http method (POST/PUT/DELETE) of a simple html link or button

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.