Remote jQuery validation with generated server error message

I am using the Validation jQuery plugin for validation. I have a service that returns true and false right now, and everything is fine.

However, the error message I'm using is "This name has already been accepted."

I want the error message to be "That name is already <a href="/item?id=543"> taken</a>."where this element is something returned from the server. But I can’t understand how to return anything from the server, except for one true or false, and still have a validation job.

I know I can do "Name xxx accepted" using JQuery.Format ("Accepted name {0}"), but I really want to give a hyperlink to an existing element, and I don’t want to change the position pages to accept a name instead of an identifier .

+5
source share
1 answer

The validation plugin handles this already, but the type of call "json", so you need to make sure that the string (error message) is transmitted in quotation marks, for example:

"Error Message"

The plugin will use this as a displayed error message, convenient? :)

+9
source

All Articles