handleCommentSubmit:function(comment)
{
console.log('pohach gaye bhaiyaa');
var request = {
'request':{
'ActorSId':667275,
'ParentPostId':null,
'PostStatus':null,
'Action':'Operate',
'PostRecipients':[],
'PostRecipientsAction':'DonotOperate',
'PostAttributes':[],
'PostAttributesAction':'DonotOperate',
'PostTags':[],
'PostTagsAction':'DonotOperate',
'PostAssetAttachments':[],
'PostAssetAttachmentsAction':'DonotOperate',
'PostContent':[{comment:""}],
'PostContentAction':'DonotOperate'
}
};
$.ajax({
url:'http://kmserver28:3535/Alto/Post/PostWS.asmx/AddKonnectPost',
dataType:'json',
type:'POST',
data:JSON.stringify(request),
success:function(data){
this.state.data.push(data);
this.setState({data:this.state.data})
}.bind(this),
error: function(xhr, status, err) {
console.error(this.props.url, status, err.toString());
}.bind(this)
});
},
var CommentForm = React.createClass({
myFunction:function(e)
{
console.log('9999999999999999999999');
e.preventDefault();
var comm =(React.findDOMNode(this.refs.text).value.trim());
console.log(comm);
this.props.onCommentSubmit(comm);
**
// i'm trying to call the function handleCommentSubmit() from here and
// it is giving error as : "Object expected". Request structure is in the above function**
},
render:function(){
return(
<form className="commentForm" onSubmit={this.myFunction}>
<input className="inputText1" type="text" placeholder="Please Enter Your Comment Here ...." ref="text" /><br /><br />
<input className="Submit1" type="submit" value="Post" />
</form>
);
}
});
答案 0 :(得分:0)
contentType:'application / json;字符集= UTF-8' ,
在ajax请求中添加此行只是诀窍, 很抱歉给您带来不便。