jquery - The name 'Request' does not exist in the current context, ajax url and response data member -


here function called controller:

    public actionresult executerule(string rawsql, list<pdsmatchruleparam> parameters)     {         var da = new dataaccess();         var rulesql = rulerawsql.replace(@"{key}", "@pkey");         var dbparameters = new list<dataaccess.dbparameter>();          dbparameters.add(new dataaccess.dbparameter("pkey", dbtype.ansistring, 4000,             parameters[4].defaultvalue));          var dt = da.select(rulesql, dbparameters.toarray());          // required eliminate "a circular reference detected while serializing object of type 'system.reflection.runtimemodule'" exception         var db = jsonconvert.serializeobject(dt,             formatting.none,             new jsonserializersettings()             {                 referenceloophandling = newtonsoft.json.referenceloophandling.ignore             });          var result = new jsonresult()         {             contenttype = "application/json",             jsonrequestbehavior = jsonrequestbehavior.allowget,         };         result.data = db;          return result;     } 

the above ds.select call returns data. after above code executes, when analyze network traffic in browser, gives me info:

general: remote address:[::1]:41678 request url:http://localhost:41678/match.mvc/ruleresultsgrid? _=1436385801737 request method:get status code:401 unauthorized 

when check value of request in immediate window, get:

the name 'request' not exist in current context 

here of javascript code:

function execrule() {     $.ajax({         type: 'post',         url: "executerule",         contenttype: 'application/json; charset=utf-8',         data: json.stringify({             rulesql : pagestate.sqleditor.rulesql.getvalue(),             parameters: pagestate.ruleparameters         }),     }).done(function(obj) {         pagestate.ruleresultsgrid = response.queryresultscontainer;         bindruleresults();     }); } 

what missing? have not set in javascript? 'request' property need have value, because when function called in same controller, 'request' not exist, returns data kendo grid? here network log of executing other method in same controller populates data grid:

general: remote address:[::1]:41678 request url:http://localhost:41678/match.mvc/executeruleset request method:post status code:200 ok 

please note application supports authentication, have turned off during development, should not getting "401 unauthorized" error because of permissions problem. seems reason asp.net mvc not generating response page. have suggestions? tia.

update:

ok, i've found 1 problem--in execrule function had url improperly set name of rule result grid url: "ruleresultsgrid", instead of name of controller action.

now i'm getting error:

uncaught referenceerror: response not defined   @ object.eval (eval @ evaluate (unknown source), <anonymous>:1:1)   @ object.injectedscript._evaluateon (<anonymous>:895:55)   @ object.injectedscript._evaluateandwrap (<anonymous>:828:34)   @ object.injectedscript.evaluateoncallframe (<anonymous>:954:21)   @ object.<anonymous> (http://localhost:41678/scripts/match/eiq.match.config.js:617:45)   @ fire (http://localhost:41678/scripts/jquery/1.9.1/jquery.js:1037:30)   @ object.self.firewith [as resolvewith] (http://localhost:41678/scripts/jquery/1.9.1/jquery.js:1148:7)   @ done (http://localhost:41678/scripts/jquery/1.9.1/jquery.js:8084:14)   @ xmlhttprequest.send.callback (http://localhost:41678/scripts/jquery/1.9.1/jquery.js:8608:8) 

ok, i've found problem--here fixed execrule():

function execrule() {     $.ajax({         type: 'post',         url: "executerule",         contenttype: 'application/json; charset=utf-8',         data: json.stringify({             rulesql : pagestate.sqleditor.rulesql.getvalue(),             parameters: pagestate.ruleparameters         }),         success: function (matchedlist) {             pagestate.ruleresult = matchedlist;              var datasource = new kendo.data.datasource({                 data: matchedlist             });             grids.ruleresultsgrid.setdatasource(datasource);             updatebuttonstates();         }     }); } 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -