2

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

2

2 Answers 2

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/

Sign up to request clarification or add additional context in comments.

1 Comment

Check this also. Although I would recommend you search if it can be done with jquery. It will minimize your code size stackoverflow.com/questions/275761/…
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.

1 Comment

@NirdoshShrestha: Welcome for next. you should up vote the answer if it helped you anyhow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.