I have a form, I want to check the username is availability. I that I have html textbox, in Onclcik I’m calling java script function. The script has to call the Action methods in controller. Based upon the username availability it has to return either 1 or 0. I have tried Json. But its is showing “Microsoft JScript runtime error: ‘$’ is undefined”. Can anyone help me in this.
Share
If you get that message it means you’re trying to use jQuery but you haven’t included the library. You can use Google’s CDN.
I guess you’ve used Ajax to call. Something like this:
If you’re using a POST you have to decorate your action with the attribute
[HttpPost]and remember to specify
JsonRequestBehavior.DenyGetwhen you return your JSON object: