Jquery.ajax send parameter called .Net Mvc method returns a sub-sub-page embed the current page

Original link: http://www.cnblogs.com/andrewhappy/p/5437280.html
  • Front page:

    < Div ID = "placeholder">

    </div>

.ajax $ ({
            URL: ' @ Url.Action ( " sub-method ")'     // Call sub-method (Child Action)
            type: ' the POST ',
            Data: ({Parameter name: value})      // Note parenthesis         
            dataType: 'html',        // returns html format
            Success: function (Result) {$ ( ' # placeholder' ) .html (Result);}

  •  Backend Control:

    [HttpPost]
        public ActionResult sub-method ( String parameter name)
        {...}

  • Backend Child View:

     < P > Why Why < / P >

Reproduced in: https: //www.cnblogs.com/andrewhappy/p/5437280.html

Guess you like

Origin blog.csdn.net/weixin_30797027/article/details/94785548