1

So i have posted div which can be edited or deleted.Take a look at given link

Here is the JS fiddle link

Now i want the original code in html to get updated and show updated information on page refresh/reload after Edit or Delete operation is performed.

Thanks for help.

Richa
  • 3,261
  • 2
  • 27
  • 51
  • No down vote please. If you fell it is wrong question i will edit/delete it.Thanks – Richa Mar 26 '14 at 09:48
  • 1
    question too ambiguous, what html to get updated? you want to store origonal values that were there Before Edit/Delete?? more information / post code + what you've tried. I always undo downvotes after edits to make them clearer bud. – JF it Mar 26 '14 at 09:50
  • Html within div should get updated.No i don't to store original values that were there before .If you had a look at js fiddle,after clicking edit,div elements can be edited.Now after editing i want the edited thing to take place in my original html code too. Thanks – Richa Mar 26 '14 at 09:52
  • When you say "in my origonal html" you mean so that when page is reloaded it will have updated information? – JF it Mar 26 '14 at 10:03
  • Yes that's totally what i wanted to say sir:) – Richa Mar 26 '14 at 10:03
  • You'll need to store the values in a database or something.. what kinda backend/framework are you using? – JF it Mar 26 '14 at 10:14
  • Asking about Db, i am SQL DB as backend – Richa Mar 26 '14 at 10:16
  • Waiting for your help sir :) – Richa Mar 26 '14 at 10:41
  • 1
    ok - i suggest on your `done` button click, use jquery ajax https://api.jquery.com/jQuery.ajax/ to send the input from the user (escaped using http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery) to the db.. then encoding it again on the page load when you fill your div with the saved data from the DB.. I cant really help you with that though, maybe that gives you an idea/start though? – JF it Mar 26 '14 at 11:01
  • 1
    few notes though - use a parametrised stored procedure to store the html in the database .. otherwise you'll be vulnerable to sql injection (https://www.google.de/search?q=sql+injection+prevention&oq=sql+injection+prevention&aqs=chrome..69i57j0l5.3848j0j9&sourceid=chrome&espv=2&es_sm=93&ie=UTF-8) – JF it Mar 26 '14 at 11:04
  • Thanks a lot,that will definitely help me to start up.Thanks for help – Richa Mar 26 '14 at 11:07
  • Alright, Thanks @RS26. Hope you get it sorted. – JF it Mar 26 '14 at 11:17
  • 1
    Hey there RS26, this a good resource for you to start http://gordoncluster.wordpress.com/2013/09/18/how-to-insert-data-into-mysql-database-using-jquery-ajax-php/ – rafaelcastrocouto Mar 26 '14 at 12:42

1 Answers1

1

Saving input from the User and showing on page load

I suggest on your done button click, use jquery ajax api.jquery.com/jQuery.ajax to send the input from the user (escaped using stackoverflow.com/questions/24816/…) to the db.. then encoding it again on the page load when you fill your div with the saved data from the DB..

few notes though - use a parametrised stored procedure to store the html in the database .. otherwise you'll be vulnerable to sql injection (google.de/…) –

JF it
  • 2,403
  • 3
  • 20
  • 30