$(document).ready(function ()
{
$(".addquestion").unbind('click').click(function(e){
e.preventDefault();
alert(1);console.log(this);
var context = $(this).parent();
var question = $("#QuestionName",context).val();
var sid = $("input[name='sid']",context).val();
var location = $("input[name='Image']",context).val();
var options = [];
options[0] = $("input[name='TextOption1']",context).val();
options[1] = $("input[name='TextOption2']",context).val();
options[2] = $("input[name='TextOption3']",context).val();
options[3] = $("input[name='TextOption4']",context).val();
options[4] = $("input[name='TextOption5']",context).val();
var answer = $('input:radio[name=Option]:checked').val();
var data = {"Question":question,"options":options,"answer":answer,"sid":sid,"Location":location}
alert(JSON.stringify(data));
var successCallBack= function()
{
alert('saved');
};
var errorCallBack=function()
{
alert('errorCallBack');
};
$.ajax({
url: "questions/add/19",
contentType: 'application/json',
dataType: 'json',
data: data,
type: "POST",
success: successCallBack,
error: errorCallBack
});
});
});
我的控制器中应该有什么。捕获他发布的字符串