I am making application where i need to insert value which are double clicked.can any one suggest me how to insert a word in database after double click in any word in a paragraph.
Like
http://www.thefreedictionary.com
In this Website after double click it search the meaning of that word, but i have to insert double clicked value in database.Please help me if any body have idea.
thanks in advance
Asked
Active
Viewed 337 times
2
-
use jQuery ajax http://api.jquery.com/jQuery.ajax/ – sravis Dec 11 '13 at 06:07
-
Refer to this link http://stackoverflow.com/questions/12321511/get-the-current-word-in-paragraph-on-click-event-in-jquery – user2936213 Dec 11 '13 at 06:09
2 Answers
3
use AJAX preferably with jQuery. The process should work like this: dbclick->take data->initiate ajax request with POST to a PHP page->execute
Some sample code :
$('element').dblclick(function(){
var data = //your handler here
$.ajax({
//code here
});
});
Take a look at this: http://api.jquery.com/jQuery.ajax/

MayTheSchwartzBeWithYou
- 1,181
- 1
- 16
- 32
-
Check this also. Although I would recommend you search if it can be done with jquery. It will minimize your code size http://stackoverflow.com/questions/275761/how-to-get-selected-text-from-textbox-control-with-javascript – MayTheSchwartzBeWithYou Dec 11 '13 at 18:25
2
On page load, initiate one function which listen for double click. You can get jquery for it easily.
On click post selected text
i.e. word
through post(preferable) or get method to page which performs database insertion.

user123
- 5,269
- 16
- 73
- 121
-
@NirdoshShrestha: Welcome for next. you should up vote the answer if it helped you anyhow – user123 Dec 11 '13 at 09:02