jquery-form / jquery-form/form
Post json within request body
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.1k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
This is a feature request, and I think it's raised in #531 but misunderstanded
Description:
Now only form data format is supported in this plugin, I'd like to post json data in post body (like this: https://stackoverflow.com/questions/5570747/jquery-posting-json)
In jquery it can be done with code below:
$.ajax(url, {
data : JSON.stringify(myJSObject),
contentType : 'application/json',
type : 'POST',
...
Expected Behavior:
With option:
contentType : 'application/json',
Request body like this :
{"name":"apple","count":"1"}
Actual behavior:
Unsupported, now only encoded form data can be in post body
Request body like this:
name=apple&count=1
Why
It's quite common in now days for communicating with server in protocol of json instead of form data, so this feature is needed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no file or test; start by locating the plugin's request serialization and contentType handling. Verify that application/json produces the stated JSON body while existing form-encoded submission remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100