How to send data with load function in jquery

I want to send string data using jquery load function but it doesn’t send it, my code

 function dialog(data) {
            $(function () {
                alert(data);
                var ph = $("#Org1");
                ph.empty();
                ph.load("/FrontEnd/DocsDownload", data, function () {
                    ph.dialog({
                        width: 500,
                        modal: true,
                        show: 'slide',
                        closeText: 'hide',
                        draggable: false,
                        resizable: false,
                        title: "Download"
                    });
                });
            });
        }

alert will show me the data, but when it goes to this controller, and I select the value from the data variable, it has a null value. My controller code

public ActionResult DocsDownload(string data)
{
}

what could be the problem?

+3
source share
1 answer

The data parameter is a name / value pair:

.load('/FrontEnd/DocsDownload', { data: 'Hello World' }, function () { 

And send a few parameters:

.load('/FrontEnd/DocsDownload', { param1: 'value1', param2: 'value2' }, function () { 
+8
source

Source: https://habr.com/ru/post/1765496/


All Articles