0

I am new to MVC. I have one button that when clicked, opens a modal pop up (JQuery). In this modal I have 10 DropDownLists, and I create a specific key with all the selected values from those dropdowns. I also have another button that opens another modal. Here's where I get confused: I need to do a query that includes the key, and with this result, I need to fill a WebGrid in the second modal.

How can I do this? I've been thinking about one actionlink or a partial view, or calling a method in the controller that returns the list.

rene
  • 41,474
  • 78
  • 114
  • 152
Lio
  • 5
  • 1
  • 3
  • 5
  • Have you tried use $.ajax of JQuery? – Ascension Aug 29 '12 at 23:42
  • i've alredy do this using .load() of jQuery, but now i need to send one parameter to my action, do you know how to do this ? – Lio Aug 30 '12 at 21:15
  • Look here: http://api.jquery.com/load/ Your use: `$("id").load("page", {parans format json}, function(response, status, XMLHttpRequest){ action });` In response you get the answer. In status you get the status('success', 'error'). – Ascension Aug 30 '12 at 22:57

1 Answers1

0

With ajax is easy, look:

$.ajax({
  type: "POST", // type of request
  url: "page.php", // page
  dataType: 'JSON', // Format of send and response
  data: { id: "2", name: "example" }, // data in JSON format
  sucess: function(response) {
    alert('The response was: ' + response); // All ok
  },
  error: function() {
    alert('Connection expired!'); // Request failed
  }
});
Ascension
  • 2,599
  • 2
  • 15
  • 13