0

In our MVC application , We are using session in SQL mode.

The issue is while using json, it is returning null values.

Code is

$.ajax({
    contentType: 'application/json; charset=utf-8',
    type: "POST",
    url: "ShowReports",
    data: JSON.stringify(ElementDatas),
    cache: false,
    async: false,
    success: function (result) {
        if ((result.message != "")
            {
             }      
        }   

controller.cs

public ActionResult ShowReports(ElementDatas elements)
{
    return Json(new { message = message});
}

Suppose if we are using session in proc mode, then json returning values. Please help..

ekad
  • 14,436
  • 26
  • 44
  • 46
sathish
  • 57
  • 6

1 Answers1

0

Try this ;

  $.ajax({
        url: "Home/ShowReports", 
        type: "POST",
        contentType: 'application/json; charset=utf-8',
        dataType:'json',
        data: JSON.stringify({elements: elements}),
        cache: false,
        async: false,
        success: function (result) {
                if (result.message != ""){ }                    
            }  

first fix the your URL , parameter sending names must be the same.

You can find and fix here; Pass Multiple Parameters to jQuery ajax call

Community
  • 1
  • 1
Selman
  • 97
  • 2
  • 12