c# - jquery.getJSON() call back function doesn't execute -


i have write code perform deletion operation ajax call. c# code given below.

 [acceptverbs(httpverbs.get)]         public jsonresult delete(guid code)         {             genre obj = null;             //todo : fix hack             try             {                 obj = genre.fetch(code, currentuserid, null);                  if (obj != null)                     obj.delete(currentuserid, null);              }             catch (exception ex)             {                 return json(new                 {                     deleted = false                 }, jsonrequestbehavior.allowget);             }              return json(new             {                 deleted = true             }, jsonrequestbehavior.allowget);         } 

then have used jquery getjson() follows:

function deletegenre(code) {      $.getjson("/administration/genre/delete?code=" + code,         function (data) {             if (!data.deleted) {                 alert("warning - cannot delete genre in use.");                 return false;             }             else {                 //window.location('/administration/genre/edit');                 return false;             }          });  } 

but when execute jquery script, callback function doesn't execute. though when visit link (../administration/genre/delete?code=835e56f0-a339-4da9-8cbb-d93b12a01d37) through browser valid result ({"deleted":false}) comes.

how can solve issue. please me. in advance.

i not sure if solution supposed use single quote , not double quotes when calling method through function following:

$.getjson('/administration/genre/delete?code=' 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -