Whoops did not mean to post this twice

On Sep 9, 8:57 am, Chris <[EMAIL PROTECTED]> wrote:
> Hello All,
> I am working to get this 
> pluginhttp://15daysofjquery.com/edit-in-place-with-ajax-using-jquery-javasc...
> working.  I can successfully edit in place text, but I would like to
> take a php variable from my editing page and pass it to my updating
> the database page.  Unfortunately I don't know javascript well enough
> to do this.  The variable is the same for each div that is edited.
> Here is my code:
>
> Edit page:
> <html>
> <head>
>   <script src="jquery.js" type="text/javascript"></script>
>   <script src="jqueryEIP.js" type="text/javascript"></script>
> </head>
> <body>
> <? $date = "1176274800"; ?>
> <div class="entry">
> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
> eiusmod tempor incididunt
> </div>
> </body>
> </html>
>
> jqueryEIP.js:
> $(document).ready(function(){
>         $("span").each(function(i){
>                 setClickable(this, i);
>         })
>
> });
>
> function setClickable(obj, i) {
>         $(obj).click(function() {
>                 var textarea = '<div id="edit"><textarea rows="2" 
> cols="60">'+$
> (this).html()+'</textarea>';
>                 var button       = '<div><input type="button" value="SAVE"
> class="saveButton" /> OR <input type="button" value="CANCEL"
> class="cancelButton" /></div></div>';
>                 var revert = $(obj).html();
>                 $(obj).after(textarea+button).remove();
>                 $('.saveButton').click(function(){saveChanges(this, false, 
> i);});
>                 $('.cancelButton').click(function(){saveChanges(this, revert, 
> i);});
>         })
>         .mouseover(function() {
>                 $(obj).addClass("editable");
>         })
>         .mouseout(function() {
>                 $(obj).removeClass("editable");
>         });
>
> }//end of function setClickable
>
> function saveChanges(obj, cancel, n) {
>         if(!cancel) {
>         var t = $(obj).parent().siblings(0).val();
>         $.post("updatenotes.php",{
>           content: t,
>           n: n,
>         },function(txt){
>                 alert( txt);
>         });}
>
>         else {
>                 var t = cancel;
>         }
>
>         if(t=='') t='(click to add text)';
>                 $(obj).parent().parent().after('<span class=regular>'+t+'</
> span>').remove();
>                 setClickable($("span").get(n), n);
>         }
> Just to recap, how do pass $date to updatenotes.php using POST?
> Thank you for any help!

Reply via email to