5
Answers

MVC Ajax did not hit the JSON Result method.

balaji palani

balaji palani

8y
332
1
Below jquery code getting error on IIS web server.
(when Browser debugging getting error Url: ../Home/handlers/?action=ping&sessionID=undefined) 
         My Jquery code:

  1. $(document).ready(function () {  
  2.        $('#ddlDB1').change(function () {  
  3.            $.ajax({  
  4.                type: "post",  
  5.                url: "/DataSource/TableList",  
  6.                data: { database: $('#ddlDB1').val() },  
  7.                datatype: "json",  
  8.                traditional: true,  
  9.                success: function (data) {  
  10.                    var district = '<option>Select Table Name</option>';  
  11.                    for (var i = 0; i < data.length; i++) {  
  12.                        district += "<option value='" + data[i].Value + "'>" + data[i].Text + "</option>";  
  13.                        //district = district + '<option value=' + data[i].Value + '>' + data[i].Text + '</option>';  
  14.                    }  
  15.                    //district = district + '</select>';  
  16.                    $('#ddltable1').html(district);  
  17.                }  
  18.            });  
  19.        }); 

It's working fine When executing in local system but getting error on IIS web server.
How can solve this problem.
Error message:
jquery.js:4 XHR finished loading: POST
Corresponding url is not found (/DataSource/TableList)
 
  1.  
Controller:
  1. [HttpPost]  
  2.  public JsonResult TableList(string database)  
  3.         {  
  4.             GF.LogWrite("Test"false);  
  5.                 var result = GF.GetTableList(database);  
  6.                 GF.LogWrite(result.ToString(), true);  
  7.                  
  8.             
  9.             return Json(result, JsonRequestBehavior.AllowGet);  
  10.   
  11.         }  
 
Answers (5)