axios post data vue js
JavaScript
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
router.post('/new/post', (req, res) => {
res.json(console.log("this is working" + ' ' + req.body.name));
});<template>
<form class="" method="post" @submit.prevent="postNow">
<input type="text" name="" value="" v-model="name">
<button type="submit" name="button">Submit</button>
</form>
</template>
export default {
name: 'formPost',
data() {
return {
name: '',
show: false,
};
},
methods: {
postNow() {
axios.post('http://localhost:3030/api/new/post', {
headers: {
'Content-type': 'application/x-www-form-urlencoded',
},
body: this.name,
});
},
components: {
Headers,
Footers,
},
};
Also in JavaScript:
- Title
- getting the value of pi in javascript
- Category
- JavaScript
- Title
- javascript change hidden input value
- Category
- JavaScript
- Title
- how to access array datat in class component react
- Category
- JavaScript
- Title
- how to use hooks react
- Category
- JavaScript
- Title
- how to empty form after submit react
- Category
- JavaScript
- Title
- drupal 8 node has field
- Category
- JavaScript
- Title
- Can't bind to 'formGroup' since it isn't a known property of 'form'
- Category
- JavaScript
- Title
- event.persist()
- Category
- JavaScript
- Title
- form validation in reactstrap
- Category
- JavaScript
- Title
- compress string javascript
- Category
- JavaScript
- Title
- get and set es6
- Category
- JavaScript
- Title
- append to array js
- Category
- JavaScript
- Title
- how to version a react app azure pipelines
- Category
- JavaScript
- Title
- express get params after ?
- Category
- JavaScript
- Title
- ion-fab-button ionic angular
- Category
- JavaScript
- Title
- call javascript function from html
- Category
- JavaScript
- Title
- chrome extension get current tab from popup
- Category
- JavaScript
- Title
- how to loop through array of numbers in javascript
- Category
- JavaScript
- Title
- electron Uncaught ReferenceError: require is not defined at recorder.js:1
- Category
- JavaScript
- Title
- get a div text content and store in a variable js
- Category
- JavaScript
- Title
- get the state of a checkbox
- Category
- JavaScript
- Title
- canvas container page offset
- Category
- JavaScript
- Title
- change text of element js
- Category
- JavaScript
- Title
- gulp-download-stream
- Category
- JavaScript
- Title
- chart js title
- Category
- JavaScript
- Title
- discord js bot leave voice channel
- Category
- JavaScript
- Title
- discord.js how to go back a file
- Category
- JavaScript
- Title
- how to make actionsheet on cordova forandroid
- Category
- JavaScript
- Title
- howt to convert 2020-02-01T08:54:07.284Z to date in javascript react
- Category
- JavaScript
- Title
- chart js rotating the x axis labels
- Category
- JavaScript
- Title
- javascript alert
- Category
- JavaScript
- Title
- angular 8 to 9
- Category
- JavaScript
- Title
- javacript getHTTPURL
- Category
- JavaScript
- Title
- how to iterate through an object in javascript
- Category
- JavaScript
- Title
- how to create array in javascript
- Category
- JavaScript
- Title
- axios post with header
- Category
- JavaScript
- Title
- create child element in javascript
- Category
- JavaScript
- Title
- javascript change class of item
- Category
- JavaScript
- Title
- error Unexpected end of JSON input while parsing near '...
- Category
- JavaScript
- Title
- javascript check for undefined
- Category
- JavaScript
- Title
- input set variable angular
- Category
- JavaScript
- Title
- how to find id in array javascript
- Category
- JavaScript
- Title
- How can I refresh a page with jQuery
- Category
- JavaScript
- Title
- adding bootstrap to angular
- Category
- JavaScript
- Title
- endpoint js
- Category
- JavaScript
- Title
- heroku failed to run files from static folder in node
- Category
- JavaScript
- Title
- convert class object to json python
- Category
- JavaScript
- Title
- generate unique id javascript
- Category
- JavaScript
- Title
- javascript bootstrap ontab change
- Category
- JavaScript
- Title
- ajax .put
- Category
- JavaScript
- Title
- angular @Output()
- Category
- JavaScript
- Title
- array remove first element javascript
- Category
- JavaScript
- Title
- if alternative javascript
- Category
- JavaScript
- Title
- increase-memory-limit not working node
- Category
- JavaScript
- Title
- event listener javascript
- Category
- JavaScript
- Title
- how to add headers to the server response node js
- Category
- JavaScript
- Title
- generate thumbnail of pdf using pf js
- Category
- JavaScript
- Title
- how to change color of font in js
- Category
- JavaScript
- Title
- install node js lts ubuntu 18.04
- Category
- JavaScript
- Title
- enter event in jquery
- Category
- JavaScript
- Title
- angular material theme colors
- Category
- JavaScript
- Title
- how to remove session data on tab close in redux\
- Category
- JavaScript
- Title
- assign array to another array javascript
- Category
- JavaScript
- Title
- append item to array javascript
- Category
- JavaScript
- Title
- how to update node.js on linux
- Category
- JavaScript
- Title
- angular @Input()
- Category
- JavaScript
- Title
- disable right click javascript
- Category
- JavaScript
- Title
- chrome add a javascript bookmark
- Category
- JavaScript
- Title
- get current week number javascript
- Category
- JavaScript
- Title
- how to append in javascript
- Category
- JavaScript
- Title
- grayscale image in canvas
- Category
- JavaScript
- Title
- angular date formats
- Category
- JavaScript
- Title
- eval in javascript
- Category
- JavaScript
- Title
- How to check whether a string contains a substring in JavaScript?
- Category
- JavaScript
- Title
- how to run mocha tests on asynchronous functions in script
- Category
- JavaScript
- Title
- add item to list javascript
- Category
- JavaScript
- Title
- how to print a array js
- Category
- JavaScript
- Title
- async await javascript push
- Category
- JavaScript
- Title
- get url of page in background script
- Category
- JavaScript
- Title
- addEventListener
- Category
- JavaScript
- Title
- .join javascript
- Category
- JavaScript
- Title
- convert string to datetime javascript
- Category
- JavaScript
- Title
- javaScript Age in Dog years //write a function that takes your age and returns it to you in dog years - they say that 1 human year is equal to seven dog years function dog Years() javaScript
- Category
- JavaScript
- Title
- async await anonymous function
- Category
- JavaScript
- Title
- how to limit input type max length
- Category
- JavaScript
- Title
- how to print an array javascript
- Category
- JavaScript
- Title
- find class using jquery
- Category
- JavaScript
- Title
- api platform vue generator
- Category
- JavaScript
- Title
- how to get array values in javascript
- Category
- JavaScript
- Title
- find index of object in array javascript
- Category
- JavaScript
- Title
- angular material table
- Category
- JavaScript
- Title
- discord.js login code
- Category
- JavaScript
- Title
- double function call javascript
- Category
- JavaScript
- Title
- datatable on error.dt
- Category
- JavaScript
- Title
- how to sepaarte text in object javascript
- Category
- JavaScript
- Title
- angular delete from array by name
- Category
- JavaScript
- Title
- add val to array jquery
- Category
- JavaScript
- Title
- how to change input value in javascript using class
- Category
- JavaScript
- Title
- How to get row index and cellindex together in javascript
- Category
- JavaScript
- Title
- express middleware pass parameter
- Category
- JavaScript