Unobtrusive JavaScript with jQuery is available in MVC3.But how can I use the unobtrusive Javascript ajax with mootools?
Unobtrusive JavaScript with jQuery is available in MVC3.But how can I use the unobtrusive
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
yeah, this is trivial to do. have a look at the recently released http://mootools.net/blog/2011/12/20/mootools-behavior/, I think it supports it.
I have used this approach in my Modal.BootStrap (view source on github, link’s there) as well whereby it uses data attributes to fetch data from an ajax resource, it’s not quite the same but it certainly is a start.
I just spent 10 mins making this and it’s a good start:
http://jsfiddle.net/dimitar/zYLtQ/
works with a DOM of:
you should be able to build on that. on refactor i’d move the request events into their own methods and add some more proofing etc but it’s fine. i don’t know all mvc does but one thing that is missing is form validation events. i also added a custom event that is fired when done so your ajaxifier instance can do something particular to that form (see
data-event-success="contactFormSuccess")also, it can use default request options if not implicitly specified, even what request object to create – Request, Request.HTML, Request.JSON etc. Events like onRequest, spinners etc are also feasible… I think you just need to work your way through the options that mvc provides and build them to get started.