Some avoidance about bug
First of all, notice that each time you write:
Filter out spaces, ruby-- > str.strip and squery== > $.trim (str)
Then note:
Limit the number of words entered.
Some regular judgments are also needed for mobile phones, mailboxes and so on.
Note the handling of duplicate fields:
First be clear about what can be repeated and what can't be repeated.
Repetition should also include some judgment on the combined primary key.