return view in ajax call mvc

Connect and share knowledge within a single location that is structured and easy to search. Theres nothing wrong or bad about using them. What does the term "Equity" mean, in "Diversity, Equity and Inclusion"? I have seven steps to conclude a dualist reality. Now it has a HTML view rendered where it can get your JSON Data. I would look into the AjaxBeginForm as an alternative to BeginForm. The second will be the AJAX method to find a person by his or her ID. So youve grasped the Jira basics and know to steer clear of the 7 Deadly Sins of Using JIRA? After the ajax call my action method will return a view which is going to be loaded after the call is success. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Start here. (Basically Dog-people). If magic is accessed through tattoos, how do I prevent everyone from having magic? I'm assuming that you would like to do a partial page update, if this is the case then you would need to have your partial page rendered on the main page somewhere first, then update it after the callback and show the changes. Imagine that were calling our controller method to return all people. JavaScript and Ajax Partial Views. Can you inspect the result of that ajax call? This is the EditPfEsp view that I want to show from my controller. It seems that you want to return to ParcialView through Ajax call method, here is a simple example hope to help you: Model: public class Lesson { public string Name { get; set; } public int Grade { get; set; } public string Objectives { get; set; } public string Description { get; set; } } View(Create.cshtml): Why are trailing edge flaps used for landing? Here are some tips and tricks you will save you a lot of time and impress your colleagues. Despite being generated in a time when heavy manufacturing was more predominate, the competitive framework developed by Michael Porter (Harvard Business Review, 1977) is valuable for Website Services businesses. Have a look at the view name, it is kept as myPartial and the checkbox is checked to make the view a partial view. Would the combustion chambers of a turbine engine generate any thrust by itself? How to render an ASP.NET MVC view as a string? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. If you want to switch to a full new view, why are you making an ajax call ? What does the term "Equity" mean, in "Diversity, Equity and Inclusion"? So, instead of passing the value in jQuery, you need to create an object with the name of the form value: Test it out! A better way would be to facilitate this as the contents of an AjaxBeginForm and have the view injected into a placeholder. Now that we have our controller, we just need to create an Index view to house our client-side markup and JavaScript. Do publishers accept translation of papers? Select Add -> View and make the Index view. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. But look at what happens when we try to return a List of strings: ! Here is our small controller class. So, let's create one simple MVC application and try to return a partial from controller and display it using jQuery AJAX. Making statements based on opinion; back them up with references or personal experience. in-between. What youre probably looking for is a RESTful API. Action method for handling jQuery AJAX operation This Action method handles the call made from the jQuery AJAX function from the View. @User987 - there is but it requires you understand the technology you are trying to use. Does playing a free game prevent others from accessing my library via Steam Family Sharing? The whole idea behind using ajax is to give the user the partial page update experience. I'm assuming that you would like to do a partial page update, if this is the case then you would need to have your partial page rendered on the main page somewhere first, then update it after the callback and show the changes. Above we are calling the "Register" action method on the "RSVP" controller and passing What I am doing wrong? Action method for handling GET operation Inside this Action method, simply the View is returned. This is not going to simply refresh the view. Here is our small controller class. What I am doing wrong? Setting up a new ASP.NET MVC project with controllers and views is pretty straightforward, with comprehensive examples on the official site. Fine, nothing is there except a paragraph tag, but in a real scenario you might use much more original stuff. On macOS installs in languages other than English, do folders such as Desktop, Documents, and Downloads have localized names? moore 30 sailboat for sale; former wisn news reporters; which refrigerators have zero clearance doors something like this, in your js, parse the text to html, you can use jquery.htmlparse. The Partial View will be returned from Controller using AJAX to jQuery AJAX method and finally it will be rendered as HTML inside DIV using jQuery in ASP.Net MVC Razor. I have seven steps to conclude a dualist reality. A GetCustomer() function is then added to the customer controller to retrieve data for a single customer in JSON format. The question may arise, why a partial view? If youre just looking for a quick reference, jump to the summary. I have seven steps to conclude a dualist reality. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, The whole point of ajax is to stay on the. I need to switch to a new one, the code of which was returned in the answer. Return view() not working with Ajax call .NET MVC. @SasanK You are more than welcome, I'm glad I could help. Above we are calling the "Register" action method on the "RSVP" controller and passing Now define an action method in the book controller that returns an ActionResult using the PartialView. How can I make an AJAX call without jQuery? Now define an action method in the book controller that returns an ActionResult using the PartialView. Topics like scalability and security are rarely met with the same excitement or urgency as customer facing features, yet they are critical to a development projects success. public JsonResult GetAmount() { var list = new List { "5 quarters", "2 nickels", "8 pennies" }; return Json(list, JsonRequestBehavior.AllowGet); }. And please note that we have added one div to the body. It contains a testPartial() function that will return a partial view as a result. Webokaloosa county noise ordinance times; esperanza poem analysis; Services Open menu. Why not a normal form submit and let the server return a redirect result ? How to correctly bias an NPN transistor without allowing base voltage to be too high. COPYRIGHT 2023 ASPSnippets.com ALL RIGHTS RESERVED. Add the parameters to the method signature, like this: [HttpPost] public JsonResult CreatePerson(string name, double amount) { var person = new Person { Name = name, Amount = amount }; //if we had an Entity Framework database, wed create the user like this //db.Person.Add(person); //db.SaveChanges(); return Json(person); }. : For beginners in ASP.Net MVC, please refer my article, ="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> Controller. Entities. Heres a quick reference for all the techniques weve discussed in this article. Why not a normal form submit and let the server return a redirect result ? As part of a Wiliam learning project, I needed to find a way to make a reusable component that could be used for the rest of our developers as a starting point on future projects. How can I get jQuery validation to produce the same markup as server-side ASP .NET MVC validation? If the data did not save correctly, then just return the view and display any validation errors. It seems that you want to return to ParcialView through Ajax call method, here is a simple example hope to help you: Model: public class Lesson { public string Name { get; set; } public int Grade { get; set; } public string Objectives { get; set; } public string Description { get; set; } } View(Create.cshtml): Above we are calling the "Register" action method on the "RSVP" controller and passing Ecommerce features to improve UX and redesigns to check out this week. You can learn more about how to use the Fetch API at Mozillas Developer Network article. We can map the concept with a master and normal page in a Web Form application. Here Mudassar Khan has explained with an example, how to redirect to another View, Page or URL after AJAX call in ASP.Net MVC Razor. Bootstrap also requires the library. We do not know what is inside that and what it is supposed to do. public JsonResult GetList() { var list = new List { "5 quarters", "2 nickels", "8 pennies" }; return Json(list, JsonRequestBehavior.AllowGet); }, public JsonResult GetItem(int id) { var item = GetItems().Where(p => p.ID == id).SingleOrDefault(); return Json(item, JsonRequestBehavior.AllowGet); }, //you can add as many parameters as you want public JsonResult GetPerson(int id, string name) { var person = GetPersonByIdAndName(id, name); return Json(person, JsonRequestBehavior.AllowGet); }, //you can also create an object instead of writing all the parameters out public class Person { public int ID { get; set; } public string Name { get; set; } public double Amount { get; set; } }, public JsonResult GetPerson(Person person) { var retrievedPerson = GetPeople().Where(p => p.ID == person.ID).SingleOrDefault(); return Json(retrievedPerson, JsonRequestBehavior.AllowGet); }, [HttpPost] public JsonResult AddAmount(double amount) { double currentAmount = GetCurrentAmount(); //in a real application, youd save the amount to a database here double newAmount = currentAmount + amount; return Json(new { newAmount = newAmount }); }, publicclassPerson { publicintID{get;set;} publicstringName{get;set;} publicdoubleAmount{get;set;} }, Display Data from Multiple Tables in a Single MVC View, Entity Framework Migrations: Existing Database, Entity Framework Stored Procedure Mapping, How to Get User Details from Active Directory, Is Udemy Legit? AJAX calls stay on the same page so RedirectToAction does not work. Here is our small controller class. Have a look at the view name, it is kept as myPartial and the checkbox is checked to make the view a partial view. Is the saying "fluid always flows from high pressure to low pressure" wrong? How do half movement and flat movement penalties interact? Provenance of mathematics quote from Robert Musil, 1913, Identify a vertical arcade shooter from the very early 1980s. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. A step by step look at improving application performance in a custom .NET MVC website using Entity Framework. Action method for handling GET operation Inside this Action method, simply the View is returned. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. In the SwearJar controller, add this method: public double GetAmount() { return 1.45; }. Asking for help, clarification, or responding to other answers. Isn't "die" the "feminine" version in German? If you want to switch to a full new view, why are you making an ajax call ? 1 Answer. WebSelect the MVC 5 Controller - Empty option, and call this controller SwearJar. Well have an input to set the amount of money to be added to the jar each time. Implementation-specific scripts that provide client-side functionality. To make our output look a little better, change the line inside the jQuery $.get callback to: Then try running the project again and clicking on the button. rev2023.4.6.43381. In the browser, I stay on the old view. On the front end, all youd have to do is create the form fields and add the form values to the data object when you make the AJAX call. If you want to redirect to the Index view, then do not use ajax. Now define an action method in the book controller that returns an ActionResult using the PartialView. Not the answer you're looking for? So, let's create one simple MVC application and try to return a partial from controller and display it using jQuery AJAX. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, I've realised that but pasted the old code. Would the combustion chambers of a turbine engine generate any thrust by itself? Well click a button, and our page will tell us how much money is in the swear jar. Where does the queen go in the Ponziani with 5 ..? Making statements based on opinion; back them up with references or personal experience. On macOS installs in languages other than English, do folders such as Desktop, Documents, and Downloads have localized names? Implementation-specific scripts that provide client-side functionality. Also remove "type: POST" in the AJAX function as I have sown you. Simply return an ActionResult using the PartialView method that will return rendered HTML to the calling JavaScript. In order to do what you are describing you would need to inject the contents inside the current views parent, however, then you will lose your BeginForm. Yeah okay I understand your answer, but how can I make the call so it really renders the view?? How to manage a redirect request after a jQuery Ajax call, JavaScript/jQuery to download file via POST with JSON data. Isn't "die" the "feminine" version in German? Here is the output. Making statements based on opinion; back them up with references or personal experience. How is the temperature of an ideal gas independent of the type of molecule? So the data variable returned contains the view and this could be used to populate any element on the view. 1 Answer. How do I return the response from an asynchronous call? Find centralized, trusted content and collaborate around the technologies you use most. We do not know what is inside that and what it is supposed to do. This is the EditPfEsp view that I want to show from my controller. This will be a good way to see how simple data types are used in AJAX controller methods. @section Scripts { //all JavaScript will go here }. Database This article makes use of the Microsofts Northwind Database. So, let's create one simple MVC application and try to return a partial from controller and display it using jQuery AJAX. Find centralized, trusted content and collaborate around the technologies you use most. moore 30 sailboat for sale; former wisn news reporters; which refrigerators have zero clearance doors Here is a link to another post that gives a pretty good overview: How to render partial view in MVC5 via ajax call to a controller and return HTML. @model IEnumerable < AldpModel. The Partial View will be returned from Controller using AJAX to jQuery AJAX method and finally it will be rendered as HTML inside DIV using jQuery in ASP.Net MVC Razor. Also, if you only want to do something with the data returned then simply return Json as in. The whole point of ajax is to give partial page update to the user . The first will create a List of people. WebOne way to do this would be to send the request to the controller via ajax and then render a partial view on your page. Do you observe increased relevance of Related Questions with our Machine How can I return the current action in an ASP.NET MVC view? Among other things, Web API helps to simplify some of the coding. melancon funeral home obituaries lafayette la; what angle relationship describes angles bce and ced; return view from ajax call mvc; by in narsa maroc khadamat. public JsonResult GetPerson(int ID, string name) { var retrievedPerson = GetPeople() .Where(p => p.ID == ID && p.Name == name) .SingleOrDefault(); return Json(retrievedPerson, JsonRequestBehavior.AllowGet); }. What is the name of this threaded tube with screws at each end? What exactly was the intent and implementation of Apple DOS 3.3's volume concept? Home; Wilam Blog; Return MVC model state errors via AJAX; keep up to date - With the latest web . The Wiliam blog is the thoughts and opinions of our people. WebYou wouldn't normally want to return a whole view via ajax - it would try to return all the Layout template as well, which should already be in the page. This wont bind to the variable in the back end. The whole point of ajax is to give partial page update to the user . Thanks for contributing an answer to Stack Overflow! Also looks like you are calling some other method CreateLookUp. How do I return the response from an asynchronous call? It looks very similar to the normal form submit(full page submit). . If there is a need to pass some more parameters along with the view, you can do the following: This feature could be extended to return multiple views with multiple parameters. You could also use an object as the single parameter in the method signature. [HttpPost] public JsonResult CreatePerson(Person person) { //if we had an Entity Framework database, wed create the user like this //db.Person.Add(person); //db.SaveChanges(); return Json(person); }. function PostMethods(url, fname, lname, email) {. I'm trying to load a view after an ajax call. JavaScript and Ajax Partial Views. The easiest way would be to use the built in ajax helpers in ASP MVC. To learn more, see our tips on writing great answers. I'll need to create another question to not mess up anymore. Check the homogeneity of variance assumption by residuals against fitted values. From cryptography to consensus: Q&A with CTO David Schwartz on building Building an API is half the battle (Ep. Notice especially the second parameter in the return line, JsonRequestBehavior.AllowGet. Also looks like you are calling some other method CreateLookUp. Simply return an ActionResult using the PartialView method that will return rendered HTML to the calling JavaScript. So, when the output comes, it will attach to the div tag. But if and only if Data saves successfully. I'm trying to call a presentation on the face of the GridVew. Inside of getAmount, we retrieve the URL of our controller method by using the Url.Action HTML helper. The usual way to return a partial view as a JsonResult to an Ajax call is done as shown below: Here the controller converts the partial view into the corresponding html content while passing it back to the Ajax call. What I am doing wrong? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Plagiarism flag and moderator tooling has launched to Stack Overflow! To subscribe to this RSS feed, copy and paste this URL into your RSS reader. The Controller consists of two Action methods. @StephenMuecke I wanted to use that but my html is not much reliable for that. WebOne way to do this would be to send the request to the controller via ajax and then render a partial view on your page. @model IEnumerable < AldpModel. Also remove "type: POST" in the AJAX function as I have sown you. As with the $.get method, notice that Im passing a dataobject to the $.post method. The whole point of ajax is to stay on the same page. The Partial View will be returned from Controller using AJAX to jQuery AJAX method and finally it will be rendered as HTML inside DIV using jQuery in ASP.Net MVC Razor. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Lets now turn to the Javascript code in our view. Here it is. public JsonResult GetPerson(Person person) { var retrievedPerson = GetPeople() .Where(p => p.ID == person.ID && p.Name == person.Name) .SingleOrDefault(); return Json(retrievedPerson, JsonRequestBehavior.AllowGet); }. The Ajax.ActionLink () helper method used above is built-into ASP.NET MVC and is similar to the Html.ActionLink () helper method except that instead of performing a standard navigation it makes an AJAX call to the action method when the link is clicked. In the HTML of the current view has an empty to show the error message. Anyways, I do prefer changing it not to be asynchronous, so I won't have to change the whole view for this as you describe, Sorry, your last comment makes no sense - it has nothing to do with asynchronous or synchronous. How do half movement and flat movement penalties interact? Why do the right claim that Hitler was left-wing? If you want to switch to a full new view, why are you making an ajax call ? rev2023.4.6.43381. To learn more, see our tips on writing great answers. (This would normally be done with a database). By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Visual Studio automatically includes jQuery on the Shared/_Layout.cshtml page, so every View ought to be able to access it already. @model IEnumerable < AldpModel. private List GetPeople() { List people = new List { new Person { ID = 1, Name = "Ernest Ruslan", Amount = 20.85 }, new Person { ID = 2, Name = "Zygmunt Delores", Amount = 3.25 }, new Person { ID = 3, Name = "Kama Nilofer", Amount = 8.10 }, }; public JsonResult GetPerson(int id) { var person = GetPeople().Where(p => p.ID == id).SingleOrDefault(); return Json(person, JsonRequestBehavior.AllowGet); }. It seems that you want to return to ParcialView through Ajax call method, here is a simple example hope to help you: Model: public class Lesson { public string Name { get; set; } public int Grade { get; set; } public string Objectives { get; set; } public string Description { get; set; } } View(Create.cshtml): [trying to return a List from ajax controller](/images/jquery-ajax-call-to-mvc-controller-10.png). Then a simple customer class is created as part of the data model. You need to modify your controller to return JSON, for example [HttpPost] public JsonResult RegisterAndLogin(UserRegisterViewModel model) { bool successToStoreData = SomeMethod(model); if (successToStoreData) { return null; // indicates success } else { melancon funeral home obituaries lafayette la; what angle relationship describes angles bce and ced; return view from ajax call mvc; by in narsa maroc khadamat. View ( ) function that will return a partial view as a string am doing wrong: lets! Request after a jQuery ajax call simple customer class is created as part of the coding of time impress. An alternative to BeginForm the return view in ajax call mvc you use most, like strings and integers controller.! > to show from my controller personal experience the jar each time result of ajax. Requires you understand the technology you are trying to call the controller method make an ajax.NET. '' in the ajax function from the very early 1980s the user vertical arcade shooter the... But its difficult to find one that teaches you the big picture, or the steps in! Json data partial view as a full new view, then do not what. The SwearJar controller, well display it using jQuery ajax imagine that were calling our controller method know to clear... Notice that Im passing a dataobject to the calling JavaScript the option of updating parts of your page... Every view ought to be loaded after the call is success, if you to. Is n't `` die '' the `` RSVP '' controller and display any validation errors would... Injected into a placeholder or personal experience use an object as the result of that ajax call SasanK. Your web page without reloading the entire page performance in a real.. Where it can get your JSON data use ajax the HTML of the data is returned this article,... Collaborate around the technologies you use most my action method will return rendered HTML the... Us how much money is in the SwearJar div return 1.45 ; } the Answer such as,. Would the combustion chambers of a turbine engine generate any thrust by itself localized names coworkers, Reach developers technologists..., clarification, or the steps involved in a real scenario you have... Return view ( ) function that will return a partial from controller display... Q & a with CTO David Schwartz on building building an API half. Populate any element on the Shared/_Layout.cshtml page, so every view ought to be synchronous be done with database. To not mess up anymore, see our tips on writing great answers jQuery validation produce! Fancier and add parameters to our terms of service, privacy policy and cookie policy ), Improving ST_Intersects in! A variety of data types are used in ajax helpers in ASP MVC 7! To BeginForm much more original stuff Entity Framework function as I have seven steps to conclude dualist! Have localized names redirect result much money is in the book controller that returns ActionResult. Ajax call and try to return a partial from controller and passing what I am doing wrong returned... The contents of an AjaxBeginForm and have the view injected into a.... Engine generate any thrust by itself the intent and implementation of Apple DOS 3.3 's volume concept class the! Using ajax is to stay on the same markup as server-side ASP.NET.... Be used to populate any element on the same way, like strings and integers synchronous... Updating parts of your web page without reloading the entire page probably looking for a single that. A single customer in JSON format for feature development the data returned then simply return JSON as in 2023.! Calling some other method CreateLookUp just return the view some other method CreateLookUp well have an input to the! Jquery ajax esperanza poem analysis ; Services Open menu back them up with references personal... A quick reference for all the techniques weve discussed in this article '' https: //www.youtube.com/embed/ukudDpgDU48 '' title= ''...., but how can I make an ajax call my action method for handling jQuery ajax call my action,..., the code of which was returned in the return line, JsonRequestBehavior.AllowGet,. Penalties interact has a HTML view rendered where it can get your data. Moderator tooling has launched to Stack Overflow return view in ajax call mvc return an ActionResult using the PartialView Studio automatically includes jQuery on ``... Open menu testPartial ( ) not working with ajax call pixels are if. Half the battle ( Ep simply the view half the battle ( Ep looks similar! 'M glad I could help normal page in a web form application where the... And passing what I am doing wrong & a with CTO David Schwartz on building! I return the response from an asynchronous call gas independent of the current action an. Html of the type of molecule simple customer class is created as part of coding... Javascript/Jquery to download file via Post with JSON data the response from an call! Function PostMethods ( URL, fname, lname and email, then not. Is called, the turget view is returned that Hitler was left-wing setting up new... Using ajax is to stay on the same way, like strings and integers RSS reader but how I... Identify a vertical arcade shooter from the jQuery ajax call without jQuery via Steam return view in ajax call mvc?... Do not use ajax with JSON data, Equity and Inclusion '' Improving the copy in the function. New one, the turget view is not much reliable for that the variable in book... The whole point of ajax is to give partial page update to the JavaScript code in our.... Normally be done with a master and normal page in a real.. From the jQuery ajax making ajax requests, it is very simple to return HTML content as single! Same markup as server-side ASP.NET MVC website using Entity Framework of Related questions our! Request after a jQuery ajax call, JavaScript/jQuery to download file via Post JSON... Input to set the amount of money to be able to access it already types are used ajax... Official site Mozillas Developer Network article in this article view is not reliable. Of time and impress your colleagues Shared/_Layout.cshtml page, so every view ought be... Thrust by itself same page so RedirectToAction does not work, privacy and... Can two BJT transistors work as a string your comment I now understand what you want to do asynchronous?... Controller to retrieve data for a single customer in JSON format Steam Family Sharing @ you... Json as in '' mean, in `` return view in ajax call mvc, Equity and ''. The very early 1980s to call the controller, we use jQuery to call a on! Call.NET MVC website using Entity Framework an asynchronous call: Q & a with CTO David Schwartz building. You an error I return the current action in an ASP.NET MVC view?. Comprehensive examples on the same page this will be a good way to see how simple data types in SwearJar! Has an Empty < spam > to show from my controller return line, JsonRequestBehavior.AllowGet generate any thrust by?! Steps involved in a custom.NET MVC mean, in `` Diversity, Equity and ''! //All JavaScript will go here } it has a HTML view rendered where it can get JSON. The very early 1980s page update experience able to access it already of strings!. Relevance of Related questions with our Machine return view in ajax call mvc can I get jQuery validation to the. Always flows from high pressure to low pressure '' wrong custom.NET MVC validation a form... What is the EditPfEsp view that I want to switch to a full new view, why partial! Action methods / logo 2023 Stack Exchange Inc ; user contributions licensed under CC.... A web form application the steps involved in a real task `` Diversity, Equity Inclusion! The browser, I stay on the `` Register '' action method in the return line, JsonRequestBehavior.AllowGet is. The concept with a master and normal page in a real application jar each time really... Index view to house our client-side markup and JavaScript button, and have! This wont bind to the JavaScript code in our view on building building an API is half the battle Ep. Mocks, Boulders in Valleys - Magnetic Confinement for feature development what it is supposed to do the calling.! Our page will tell us how much money is in the Ponziani 5. Our terms of service, privacy policy and cookie policy official site more, see our on... If doing so reduces their distance to the JavaScript code in our view of which was in! At what happens when we try to return a redirect result and easy to search section Scripts { JavaScript. To simply refresh the view? with 5.. give return view in ajax call mvc user show the error message where &. So reduces their distance to the source of their fear updating parts of your web without... All people call this controller SwearJar with JSON data too high, Improving copy... Persist this to a full new view, why are you making an ajax call poem... ; back them up with references or personal experience simply the view this... The EditPfEsp view that I want to switch to a full new view, are! Point of ajax is to give partial page update to the normal form submit and let the server return List. Feed, copy and paste this URL into your RSS reader use jQuery to call the controller, use! Is going to be synchronous to learn more, see our tips on writing great.! Does not work calls stay on the face of the current view has an Empty < spam > to from. Each end, see our tips on writing great answers I need to create an Index view calling an is. Rss feed, copy and paste this URL into your RSS reader, add the following two controller methods.