从MVC3中的jQuery中的模型中调用方法 [英] Calling Method in model from jquery in mvc3
本文介绍了从MVC3中的jQuery中的模型中调用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在我的项目(mvc3)中创建一个登录页面.
我有要从数据库验证的用户名和密码.
我的视图包含用户名和密码的文本框,
和一个提交按钮,以便在按钮上单击我要呼叫的
我模型中的一种方法.
如何调用该方法.
请帮帮我..
I am creating a Login page in my project (mvc3).
i have username and password which i want to verify from Database.
my view consist of textboxs for username & password,
and a submit button so on button click i want to call
a method in my model.
How can i Call that method.
please help me..
thnks in advance.
推荐答案
hi,
您可以使用ajax来调用方法
1)在登录控制器中开发一个返回布尔类型数据的动作
2)不要在操作上使用[HTTPPost]属性
3)在ajax调用中,创建URL,例如Controller/Action/data
这样,您可以调用方法
但这不是一种安全的身份验证方式
You can use ajax to invoke the method
1)develop a action in login controller which return bool type data
2)don''t use [HTTPPost]attribute over the action
3)In ajax call create URL like Controller/Action/data
In this way you can call the method
but it is not a secure way for authentication
这篇关于从MVC3中的jQuery中的模型中调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文