{"id":23629807,"url":"https://github.com/willworks/ajaxrequest","last_synced_at":"2025-07-03T05:01:43.741Z","repository":{"id":80025974,"uuid":"46933173","full_name":"willworks/AjaxRequest","owner":"willworks","description":"Ajax数据请求模拟，可用于接口还未开通时候的模拟返回数据","archived":false,"fork":false,"pushed_at":"2015-11-29T11:36:34.000Z","size":289,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-18T20:08:26.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/willworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-26T15:07:30.000Z","updated_at":"2015-11-27T03:26:02.000Z","dependencies_parsed_at":"2023-03-10T23:45:23.215Z","dependency_job_id":null,"html_url":"https://github.com/willworks/AjaxRequest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/willworks/AjaxRequest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willworks%2FAjaxRequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willworks%2FAjaxRequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willworks%2FAjaxRequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willworks%2FAjaxRequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willworks","download_url":"https://codeload.github.com/willworks/AjaxRequest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willworks%2FAjaxRequest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263264641,"owners_count":23439246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-28T01:18:17.584Z","updated_at":"2025-07-03T05:01:43.685Z","avatar_url":"https://github.com/willworks.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AjaxRequest\nAjax数据请求模拟，可用于接口还未开通时候的模拟返回数据\n\n#### 主要插件\n\n - [jquery-mockjax](https://github.com/jakerella/jquery-mockjax) 提供基本功能实现\n\n - [mockJSON](https://github.com/mennovanslooten/mockJSON) 内置json和jsonp请求返回的处理\n\n - [jquery.tmpl](https://github.com/BorisMoore/jquery-tmpl) jq模板引擎\n\n#### 使用方法\n\n - 发起ajax请求\n\n\t\t$.ajax({\n\t\t    url : \"http://host/api/api_name\",\n\t\t    brand_ids : \"01234,56789\",//批量查询\n\t\t    dataType : \"jsonp\",\n\t\t    jsonp : \"jsonp\",\n\t\t    success : function(res){\n\t\t        // 主要逻辑\n\t\t    }\n\t\t});\n\n - 在引入jquery-mockjax后，请求接口跟真正的设置一样，配置好返回数据，就可以进行请求的拦截、\n\n\t    $.mockjax({\n\t        url: 'http://host/api/api_name',\n\t        status: 200,\n\t        responseTime: 900,\n\t        // 模拟数据\n\t        responseText: \n\t        {\n\t            \"code\": 0,\n\t            \"data\": {\n\t                data_list: [\n\t\t\t\t\t\t// 数据返回格式\n\t                ] \n\t            },\n\t            \"msg\": \"success\"\n\t        }\n\t    });","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillworks%2Fajaxrequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillworks%2Fajaxrequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillworks%2Fajaxrequest/lists"}