jquery - AJAX send value to controller and return query results -
I want to pass a value for my controller and want to execute a query. I would then like to return the values to the query from my query, so I can allocate these values in different text boxes. I do not know how the data can be returned back to jquery. I only made AJAX calls, partial views are back. I am working in ASP.NET
You can use AJAX calls inside the function like below, you can call whenever you need it.
function (id) {$. Ajax ({url: "Your Controller / Method Path", Data: JSON.stringify ({id: id}), Data Type: "json", Type: "Post", async: false, contentType: "application / json ; Charset = utf-8 ", success: function (data) {if here you will get value from controller if you get value from data // you get value from data, Box. Depending on your requirement ..}}})
Controller method:
public JsonResult functionName (int id) {on JsonResult Nam = null; Try {var queryValue; // Here you can enter your query and assign it to the query. Change it and return it back to the UI. Results = Jason (new {breakthrough = true, data = query valueless}, JasonSuciewest Behavior Aloevitt); } Hold (Exception Pre) {Results = Jason (New {Success = false, Message = Ex. Message}, Jason Yeave Behavior.); } Return results; }}
Hope this will help you ..
Comments
Post a Comment