{"id":37365396,"url":"https://github.com/nick-lai/jquery-resource","last_synced_at":"2026-01-16T04:50:34.119Z","repository":{"id":37044001,"uuid":"235045349","full_name":"nick-lai/jquery-resource","owner":"nick-lai","description":"⚡ A jQuery plugin that abstracts the process of consuming a REST endpoint.","archived":false,"fork":false,"pushed_at":"2025-09-29T18:56:29.000Z","size":153,"stargazers_count":2,"open_issues_count":6,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-29T11:47:14.033Z","etag":null,"topics":["ajax","api","javascript","jquery","jquery-resource","rest","xhr"],"latest_commit_sha":null,"homepage":"https://nick-lai.github.io/jquery-resource","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nick-lai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"custom":["https://www.buymeacoffee.com/nicklai"]}},"created_at":"2020-01-20T07:43:36.000Z","updated_at":"2022-06-18T06:38:53.000Z","dependencies_parsed_at":"2023-02-15T10:16:40.532Z","dependency_job_id":"c1197e08-432a-4205-9ec9-47c873ebf52c","html_url":"https://github.com/nick-lai/jquery-resource","commit_stats":{"total_commits":109,"total_committers":2,"mean_commits":54.5,"dds":0.00917431192660545,"last_synced_commit":"9093fdf8341432bc1c85f14748aac336a6ce0c6a"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/nick-lai/jquery-resource","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fjquery-resource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fjquery-resource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fjquery-resource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fjquery-resource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nick-lai","download_url":"https://codeload.github.com/nick-lai/jquery-resource/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fjquery-resource/sbom","scorecard":{"id":684769,"data":{"date":"2025-08-11","repo":{"name":"github.com/nick-lai/jquery-resource","commit":"9093fdf8341432bc1c85f14748aac336a6ce0c6a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/nick-lai/jquery-resource/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/nick-lai/jquery-resource/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/nick-lai/jquery-resource/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/nick-lai/jquery-resource/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/nick-lai/jquery-resource/nodejs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/nick-lai/jquery-resource/nodejs.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/nick-lai/jquery-resource/nodejs.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:18","Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:20","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T00:25:27.881Z","repository_id":37044001,"created_at":"2025-08-22T00:25:27.881Z","updated_at":"2025-08-22T00:25:27.881Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T03:13:13.607Z","status":"ssl_error","status_checked_at":"2026-01-16T03:11:47.863Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","api","javascript","jquery","jquery-resource","rest","xhr"],"created_at":"2026-01-16T04:50:33.431Z","updated_at":"2026-01-16T04:50:34.115Z","avatar_url":"https://github.com/nick-lai.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/nicklai"],"categories":[],"sub_categories":[],"readme":"jquery-resource\n===\n\n[![CodeQL](https://github.com/nick-lai/jquery-resource/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/nick-lai/jquery-resource/actions/workflows/codeql-analysis.yml)\n[![Node.js CI](https://github.com/nick-lai/jquery-resource/actions/workflows/nodejs.yml/badge.svg)](https://github.com/nick-lai/jquery-resource/actions/workflows/nodejs.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/nick-lai/jquery-resource)](https://codecov.io/gh/nick-lai/jquery-resource)\n[![LGTM Grade](https://img.shields.io/lgtm/grade/javascript/github/nick-lai/jquery-resource)](https://lgtm.com/projects/g/nick-lai/jquery-resource/context:javascript)\n[![downloads](https://img.shields.io/npm/dt/jquery-resource)](https://www.npmtrends.com/jquery-resource)  \n[![npm](https://img.shields.io/npm/v/jquery-resource)](https://www.npmjs.com/package/jquery-resource)\n[![bundle size](https://img.shields.io/bundlephobia/minzip/jquery-resource)](https://bundlephobia.com/package/jquery-resource)\n[![LICENSE](https://badgen.net/github/license/nick-lai/jquery-resource)](https://github.com/nick-lai/jquery-resource/blob/main/LICENSE)\n\nA jQuery plugin that abstracts the process of consuming a REST endpoint.\n\n## Features\n\n- ⚡ Simple and lightweight\n- 🚀 Incredible high availability\n- ✨ Customizable ajax settings for resources\n\n## Table of Contents\n\n- [jquery-resource](#jquery-resource)\n  - [Features](#features)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n    - [CDN](#cdn)\n      - [jsDelivr](#jsdelivr)\n      - [unpkg](#unpkg)\n  - [Usage](#usage)\n    - [Methods](#methods)\n      - [post()](#post)\n      - [get()](#get)\n      - [find()](#find)\n      - [patch()](#patch)\n      - [put()](#put)\n      - [delete()](#delete)\n    - [Aliases](#aliases)\n      - [add()](#add)\n      - [create()](#create)\n      - [update()](#update)\n      - [replace()](#replace)\n    - [Custom actions](#custom-actions)\n    - [Last request](#last-request)\n      - [isPending()](#ispending)\n    - [Ajax settings](#ajax-settings)\n      - [Resource's ajax settings](#resources-ajax-settings)\n      - [Action's ajax settings](#actions-ajax-settings)\n      - [One-time ajax settings](#one-time-ajax-settings)\n  - [Inspiration](#inspiration)\n  - [License](#license)\n\n## Installation\n\n### CDN\n\njquery-resource is available on jsDelivr or unpkg.\n\n#### jsDelivr\n\nLoad jquery-resource from [jsDelivr](https://www.jsdelivr.com/package/npm/jquery-resource).\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/jquery-resource@1.4.0\"\u003e\u003c/script\u003e\n```\n\n#### unpkg\n\nLoad jquery-resource from [unpkg](https://unpkg.com/jquery-resource/dist/).\n\n```html\n\u003cscript src=\"https://unpkg.com/jquery-resource@1.4.0\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// POST /api/users\nuserResource.post({\n  email: 'george.bluth@reqres.in',\n  first_name: 'George',\n  last_name: 'Bluth'\n});\n\n// GET /api/users/1\nuserResource.get(1);\n\n// PATCH /api/users/1\nuserResource.patch(1, {\n  email: 'emma.wong@reqres.in',\n  first_name: 'Emma',\n  last_name: 'Wong'\n});\n\n// DELETE /api/users/1\nuserResource.delete(1);\n```\n\nTry it out on [JSFiddle](https://jsfiddle.net/nick_lai/2645am0h/).\n\n### Methods\n\n#### post()\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// POST /api/users\nuserResource.post({\n  email: 'george.bluth@reqres.in',\n  first_name: 'George',\n  last_name: 'Bluth'\n}).done(function () {\n  console.log('POST /api/users');\n});\n```\n\n#### get()\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// GET /api/users/1\nuserResource.get(1).done(function () {\n  console.log('GET /api/users/1');\n});\n```\n\n#### find()\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// GET /api/users?first_name=George\nuserResource.find({\n  first_name: 'George'\n}).done(function () {\n  console.log('GET /api/users?first_name=George');\n});\n```\n\n#### patch()\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// PATCH /api/users/1\nuserResource.patch(1, {\n  email: 'emma.wong@reqres.in',\n  first_name: 'Emma',\n  last_name: 'Wong'\n}).done(function () {\n  console.log('PATCH /api/users/1');\n});\n```\n\n#### put()\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// PUT /api/users/1\nuserResource.put(1, {\n  email: 'emma.wong@reqres.in',\n  first_name: 'Emma',\n  last_name: 'Wong'\n}).done(function () {\n  console.log('PUT /api/users/1');\n});\n```\n\n#### delete()\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// DELETE /api/users/1\nuserResource.delete(1).done(function () {\n  console.log('DELETE /api/users/1');\n});\n```\n\n### Aliases\n\n#### add()\n\nAlias of `post()` method.\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// POST /api/users\nuserResource.add({\n  email: 'george.bluth@reqres.in',\n  first_name: 'George',\n  last_name: 'Bluth'\n}).done(function () {\n  console.log('POST /api/users');\n});\n```\n\n#### create()\n\nAlias of `post()` method.\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// POST /api/users\nuserResource.create({\n  email: 'george.bluth@reqres.in',\n  first_name: 'George',\n  last_name: 'Bluth'\n}).done(function () {\n  console.log('POST /api/users');\n});\n```\n\n#### update()\n\nAlias of `patch()` method.\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// PATCH /api/users/1\nuserResource.update(1, {\n  email: 'emma.wong@reqres.in',\n  first_name: 'Emma',\n  last_name: 'Wong'\n}).done(function () {\n  console.log('PATCH /api/users/1');\n});\n```\n\n#### replace()\n\nAlias of `put()` method.\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users'\n});\n\n// PUT /api/users/1\nuserResource.replace(1, {\n  email: 'emma.wong@reqres.in',\n  first_name: 'Emma',\n  last_name: 'Wong'\n}).done(function () {\n  console.log('PUT /api/users/1');\n});\n```\n\n### Custom actions\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users',\n  actions: {\n    // actionName: ajaxSettings\n    save: {\n      method: 'POST',\n      url: 'https://reqres.in/api/users/save',\n    },\n    notify: {\n      method: 'POST',\n      url: 'https://reqres.in/api/users/notify',\n      // use resource id as an argument to action\n      useID: true,\n    },\n  },\n});\n\n// save(params, ajaxSettings)\nuserResource.save({\n  email: 'george.bluth@reqres.in',\n  first_name: 'George',\n  last_name: 'Bluth'\n});\n\n// notify(id, params, ajaxSettings)\nuserResource.notify(1, {\n  message: 'some message'\n});\n```\n\n### Last request\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users',\n});\n\nuserResource.get(1);\nuserResource.get(2);\n\n// action's last request\nuserResource.get.lastRequest.done(function () {\n  console.log('GET /api/users/2');\n});\n```\n\n#### isPending()\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users',\n});\n\nuserResource.get(1);\n\n// check if the last request is pending\nconsole.log(userResource.get.isPending());\n```\n\n### Ajax settings\n\n[jQuery.ajax(settings)](https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings \"jQuery.ajax() | jQuery API Documentation\")\n\n#### Resource's ajax settings\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users',\n  // use resource's ajax settings to actions\n  ajaxSettings: {\n    contentType: false,\n    processData: false\n  },\n});\n\nuserResource.get(1);\n\n// update resource's ajax settings\n$.extend(userResource.ajaxSettings, {\n  processData: true,\n});\n```\n\n#### Action's ajax settings\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users',\n  action: {\n    post: {\n      processData: false,\n    },\n  },\n});\n\n// update action's ajax settings\n$.extend(userResource.post.ajaxSettings, {\n  processData: true,\n});\n\nuserResource.post({\n  email: 'emma.wong@reqres.in',\n  first_name: 'Emma',\n  last_name: 'Wong'\n});\n```\n\n#### One-time ajax settings\n\n```javascript\nvar userResource = $.resource({\n  endpoint: 'https://reqres.in/api/users',\n  ajaxSettings: {\n    dataType: 'text'\n  },\n});\n\n// use one-time ajax settings to post\nuserResource.post({\n  email: 'emma.wong@reqres.in',\n  first_name: 'Emma',\n  last_name: 'Wong'\n}, {\n  dataType: 'json'\n});\n\n// use one-time ajax settings to actions:\n//   - post(data, ajaxSettings)\n//   - find(params, ajaxSettings)\n//   - patch(id, data, ajaxSettings)\n//   - put(id, data, ajaxSettings)\n//   - get(id, params, ajaxSettings)\n//   - delete(id, params, ajaxSettings)\n```\n\n## Inspiration\n\n- [pagekit/vue-resource](https://github.com/pagekit/vue-resource)\n  - [`Vue.resource`](https://github.com/pagekit/vue-resource/blob/develop/docs/resource.md)\n- [ngonzalvez/rest-facade](https://github.com/ngonzalvez/rest-facade)\n\n## License\n\n[MIT](https://github.com/nick-lai/jquery-resource/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnick-lai%2Fjquery-resource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnick-lai%2Fjquery-resource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnick-lai%2Fjquery-resource/lists"}