MVC page Simple get get background data

Source: Internet
Author: User

Background method

 Public actionresult Linq ()        {            var lt = Usersys.findall ();             New Hashtable ();            Ht. ADD ("data", lt);             return Json (HT, jsonrequestbehavior.allowget);        }

Page elements

<inputtype= "text"name= "ID" /><inputtype= "text"ID= "UserName" /><inputtype= "text"ID= "Active"class= "Active" /><inputtype= "button"class= "Active"value=""/>

JS Request

<script src= "~/scripts/jquery-1.10.2.min.js" ></script><script>$.ajax ({type:' Get ', datatype:' JSON ', URL:'/linq/linq ', Success:function(data) {//get an element based on name to assign a value$ ("[name= ' ID ']"). Val (data.data[1].id); //get elements based on ID to assign values$ ("#UserName"). Val (data.data[1].            UserName); //assign a value based on the class get element$ (". Active"). Val (data.data[1]. PassWord)//filter the type to a button based on the input tag, get the element to assign value$ ("Input[type=button]"). Val ("OK")        }    })

After removing excess code

// FindAll is a Xcoder generated method  without Xcode using LINQ queries can also var lt = Usersys.findall ();             // Hashtable ht = new Hashtable ();             // ht. ADD ("Data", lt);            return Json (LT, jsonrequestbehavior.allowget);

<script src= "~/scripts/jquery-1.10.2.min.js" ></script><script>//simple JQ Gets the element method to return the obtained data directly$.ajax ({type:' Get ', datatype:' JSON ', URL:'/linq/linq ', Success:function(data) {//get an element based on name to assign a value$ ("[name= ' ID ']"). Val (data[1].id); //get elements based on ID to assign values$ ("#UserName"). Val (data[1].            UserName); //assign a value based on the class get element$ (". Active"). Val (data[1]. PassWord)//filter the type to a button based on the input tag, get the element to assign value$ ("Input[type=button]"). Val ("OK")        }    })

MVC page Simple get get background data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.