I want to do ajax call of VUE.JS which can be done by axios. I am doing this call from JS file and below is code, what i tried so far.
<div id="VueCalling">
<div class="container">
<label>Please enter thought </label>
<input type="text" id="txtThought" class="form-control textboxCustm" v-model="textThought" />
</div>
<input type="button" class="btn btn-info" id="btnInsert" value="Insert JS" v-on:click="greet" />
<br />
<br />
<a href="ReadThought.aspx" class="btn btn-primary">Read all thoughts</a>
</div>
</asp:Content>
This was my HTML code and now as below mentioned JS code.
new Vue({
el: '#VueCalling',
data: function () {
return {
textThought: null,
checkbox: null,
text: null,
}
},
methods: {
greet: function (event) {
// `this` inside methods points to the Vue instance
var passedEmail = this.textThought;
// `event` is the native DOM event
axios.post('Default.aspx/InsertThoughtMethod?Thought="' + passedEmail + '"',
{
headers: {
'Content-type': 'text/xml; charset=\"utf-8\"'
},
}, function (data) {
alert(data);
}).then(function (response) {
console.log(response);
}).catch(function (error) {
console.log(error);
});
}
}
});
This is my code behind method:
[WebMethod]
public static bool InsertThoughtMethod(string Thought)
{
return true;
}
I have checked console and network logs. It is giving this error. Network Log
The debugger is not reaching till the method. I can not move further.