File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -412,17 +412,14 @@ format and make them available in your controller inside `params`.
412
412
To use this, your client will need to make a request with JSON-encoded parameters
413
413
and specify the ` Content-Type ` as ` application/json ` .
414
414
415
- Here's an example in jQuery :
415
+ Here's an example:
416
416
417
417
``` js
418
- jQuery .ajax ({
419
- type: ' POST' ,
420
- url: ' /people' ,
421
- dataType: ' json' ,
422
- contentType: ' application/json' ,
423
- data: JSON .stringify ({ person: { firstName: " Yehuda" , lastName: " Katz" } }),
424
- success : function (json ) { }
425
- });
418
+ fetch (' /people' , {
419
+ method: ' POST' ,
420
+ headers: { ' Content-Type' : ' application/json' },
421
+ body: JSON .stringify ({ person: { firstName: ' Yehuda' , lastName: ' Katz' } })
422
+ }).then (response => response .json ())
426
423
```
427
424
428
425
` ActionDispatch::Request ` will see the ` Content-Type ` and your parameters
You can’t perform that action at this time.
0 commit comments