0

I have been working with MVC 3 and the [Remote(action,controller)] seems to work perfect, trying to do the same in MVC 4 results in a never called function.

A quick google or stackoverflow search will give you lots of the same fails in MVC4.

What I did was:

Model:

[Remote("CheckIt", "Default1", ErrorMessage = "It happens")]
public virtual string City { get; set; }

In Default1 Controller:

public JsonResult CheckIt(string city)
{
    return Json(false, JsonRequestBehavior.AllowGet);
}

Thanks in Advance

tereško
  • 58,060
  • 25
  • 98
  • 150
RandomGuy42
  • 301
  • 4
  • 14
  • Do you have an online "demo" where it's possible to inspect the data going back and forth/eventual javascript exceptions, etc.? – Alxandr Jul 25 '13 at 06:32
  • Do you have client side validation enabled? – Moeri Jul 25 '13 at 06:39
  • @Alxandr No, sorry I do not, but, I can check and reply back, do you mean something like FireBug? – RandomGuy42 Jul 25 '13 at 16:15
  • @Moeri Yes, I think in MVC3 it was turned off, but at least in MVC4, I always see it turned ON by default. – RandomGuy42 Jul 25 '13 at 16:16
  • Yes, something like that, and other things. But I cannot efficiently explain all the things I would check... But if you can, check for script errors + request data. – Alxandr Jul 25 '13 at 16:31
  • Answer the following: - Do you have the jqueryval bundle rendered on the page? Check if jquery.validate.js and jquery.validate.unobtrusive.js is present - Are there data-... attributes on your input element that contain validation properties? - When you check the network tab in Firebug or Chrome Developer Tools, do you see a request being launched when you enter something in the input field (and leave it by pressing 'tab' or clicking elsewhere) - If so, does that request succeed or does it give any errors? – Moeri Jul 26 '13 at 06:01

0 Answers0