Skip to content

Commit add4f75

Browse files
sparky672jzaefferer
authored andcommitted
Remote Method: Properly document the require server response
There is a lot of confusion surrounding proper usage of the `remote` method based on the number of Stack Overflow questions about it. I am proposing this slight change to help clarify. Closes #12
1 parent 885b7b2 commit add4f75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

entries/remote-method.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<title>remote method</title>
44
<desc>Requests a resource to check the element for validity.</desc>
55
<longdesc>
6-
The serverside resource is called via jQuery.ajax (XMLHttpRequest) and gets a key/value pair corresponding to the name of the validated element and its value as a GET parameter. The response is evaluated as JSON and must be <code>true</code> for valid elements, and can be any <code>false</code>, <code>undefined</code> or <code>null</code> for invalid elements, using the default message; or a string, eg. <code>"That name is already taken, try peter123 instead"</code> to display as the error message.
6+
The serverside resource is called via jQuery.ajax (XMLHttpRequest) and gets a key/value pair corresponding to the name of the validated element and its value as a GET parameter. The serverside response must be a JSON string that must be <code>"true"</code> for valid elements, and can be <code>"false"</code>, <code>undefined</code>, or <code>null</code> for invalid elements, using the default error message. If the serverside response is a string, eg. <code>"That name is already taken, try peter123 instead"</code>, this string will be displayed as a custom error message in place of the default.
77

88
<p>For more examples, take a look the <a href="http://jqueryvalidation.org/files/demo/marketo">marketo demo</a> and the <a href="http://jqueryvalidation.org/files/demo/milk/">milk demo</a>.</p>
99
</longdesc>

0 commit comments

Comments
 (0)