Problem regarding ajax post request
Hello,
I'm trying to make ajax post request to google calendar api, but no posting is happening and the data which i want to post is in this form
{
"summary": "Title",
"start": {
dataTime: "2018-02-12T12:00:00"'
},
"end": {
dataTime: "2018-02-12T13:30:00"'
}
}
calId and token i've not given because of confidential information
Please Help
Here is the code-
var
newEvent =
function(
start,
end){
$(
'#m_modal_6').
modal(
'show');
$(
'#add_event_submit').
click(
function(){
var
title =
$(
'#title').
val();
var
start1 =
new
Date(
start);
var
end1 =
new
Date(
end);
var
dataJ = {
'summary'
:
title,
'start'
:
{
'dateTime'
:
start1
},
'end'
:
{
'dateTime'
:
end1
}
};
var
data1 =
JSON.
stringify(
dataJ);
alert(
data1);
$.
ajax({
url:
calId
+
'/events
?access_token='
+
token
,
type:
"POST",
dataType:
"jsonp",
data:
data1,
success
:
function(){
alert(
"Added Successfully");
},
error
:
function(){
alert(
"Some Error");
}
});
});
}