Friday, 15 August 2014

asp.net mvc - JQuery AJAX Post Cascading Dropdown -


I am trying to prepare the dropdown based on the value of the previous dropdown via AJAX posts, however, the URL With the method in the controller is not connecting properly. Explaining the following error in FireBug:

  "Network Error: 500 Internal Server Error - http: // localhost: 1079 / Goaletry / Gatecars"   

here My Controller:

  Public Class RoundDetailController: Controller {Private GolfTrackerEntities2 db = New GolfTrackerEntities2 (); Public JsonResult GetFacilities (Ent ID) {var Feature = DB Capabilities Distinction () ToList (); Returns Jason (features, Jason Y. Best Behavior AloGuget); }}   

Here is my javascript:

  Change the functionsection () {var val = $ (this) .val (); $ Course = $ ('# ddlCourses'); $ Type: "post", datatype: 'jason', data: "{'facility id': '' + + val +" '} "," AZ "(" URL: "URL (" GateCourses "," Golateet "), type: , Content Type: "Application / Jason", Success: Work (msg) {console.log (msg); for var list = JSON.parse (msg.d); for (var i = 0; i   

I think the problem is in your controller. So it is difficult to say what is the problem. Also, please click on the row in the firebug and take a look at the body of the reaction - it contains detailed information about the server error.

Content type application / json seems to have no need for wired JavaScript objects, and you can access data from {feature id: well} Can pass.

I'm also not sure if string is correct in making a list of alternatives via concatenation - because it is not JavaScript Injection Safe

$ courses.append ($ ("Alternatives" option can be used for "attribute" ("value", course.abbr) .text (course.Name));

Instead

No comments:

Post a Comment