Skip to content

Commit

Permalink
Change readme
Browse files Browse the repository at this point in the history
  • Loading branch information
arian committed Mar 19, 2010
1 parent afe66be commit 46d205a
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions README.md
Expand Up @@ -8,43 +8,10 @@ Request.SpellCheck will give you an array in the onSuccess event that you can us

![Screenshot](http://github.com/arian/moo-spellcheck/raw/master/screenshot.png)

How To Use
How to use
----------


## Example

window.addEvent('domready', function() {
var result = document.id('result');

var spell = new Request.SpellCheck({
url: '../Source/spellcheck.php',
onSuccess: function(suggestions,data,response,text){
result.empty();
$each(suggestions,function(sug){
new Element('span',{
'class': sug.valid ? '' : 'error',
text: sug.text
}).inject(result);
if(!sug.valid){
new Element('span',{
'class': 'suggestions',
text: '('+sug.suggestions.join(', ')+')'
}).inject(result);
}
});
}
});
spell.checkspell('Testng ths spelcheckr out.');

});


## Class: Request.SpellCheck

Expand Down Expand Up @@ -78,3 +45,37 @@ Fired when the request completes. This overrides the signature of the Request.JS
- responseText - (*string*) The JSON response as string.
- text - (*string*) The original input text


## Example

#JS
window.addEvent('domready', function() {
var result = document.id('result');

var spell = new Request.SpellCheck({
url: '../Source/spellcheck.php',
onSuccess: function(suggestions,data,response,text){
result.empty();
$each(suggestions,function(sug){
new Element('span',{
'class': sug.valid ? '' : 'error',
text: sug.text
}).inject(result);
if(!sug.valid){
new Element('span',{
'class': 'suggestions',
text: '('+sug.suggestions.join(', ')+')'
}).inject(result);
}
});
}
});
spell.checkspell('Testng ths spelcheckr out.');

});

0 comments on commit 46d205a

Please sign in to comment.