javascript - CKEditor AJAX request returning error 500 -


i'm using ckeditor on mvc site, using ajax edit 'bio' of sports team.

i have json result in controller receives string , int. on ajax request function not called.

the ajax being hit in browser, , returning 500. breakpoint in controller not being hit. failing on send function of ajax

-as note, works if user bio: "hello world", teamid: 2

cshtml

 function updatebio() {                 var myurl = "/team/updatebio";                 var teamtoedit = 2;                 ckeditor.instances.bioeditor.updateelement();                 var biostring = $("#bioeditor").val().trim();         $.ajax({             url: myurl,             data: { bio: biostring , teamid: teamtoedit  },             type: 'post',             datatype: 'json',             success: function(result) {                 $("#post-message-content").text(result.data);                 $("#post-editor").text("");                 $("#cover").hide();                 $("#feed-publish").hide();                 $("#post-message").show().delay(200).fadeout("slow")             }         });     }; 

controller

[httppost] public jsonresult updatebio(string bio,int teamid) {     team team = helpers.teamhelpers.getteambyid(teamid);     if (modelstate.isvalid &&      helpers.accounthelpers.isteamadmin(helpers.accounthelpers.currentuser, team ))     {         if (string.isnullorwhitespace(bio))         {             var result = new { success = "false", message = "post contained no text!" };             return json(result, jsonrequestbehavior.allowget);         }         else         {             mysportmanagerentities context = new mysportmanagerentities();              team.bio = bio;             context.savechanges();             var result = new { success = "true", message = "bio updated" };             return json(result, jsonrequestbehavior.allowget);          }     }     else     {         var result = new { success = "false", message = "could not update bio. try       again later." };         return json(result, jsonrequestbehavior.allowget);      }  } 


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -