asp.net mvc 5 - SyntaxError: An invalid or illegal string was specified (jquery in mvc 5) -
i have mvc 5 project code works good. have modified project , not work. not call action here jquery code :
<script type="text/javascript"> $(function () { $(document).ready(function () { var url='@url.action("loadroles", "account")'; $.post(url, function (data) { //do whatever u waht response "data" }); $.ajax({ type: 'post', cache: false, contenttype: 'application/json; charset=utf-8', url: '@url.action("loadroles", "account")', datatype: 'text/javascript', data:'', success: function (roles) { // not process section var items = '<option value="' + "0" + '">' + "type" + '</option>'; $.each(roles, function (i, role) { items += '<option value="' + role.value + '">' + role.text + '</option>'; }); $("#ddrroles").html(items); }, error: function (ex) { alert('failed retrieve cities.' + ex); } }); return false; }) });
i had remove few cshtml razor comments (starting @* , ending *@) unneeded dead code resolve syntax error in title of question. in case.
Comments
Post a Comment