Search code examples
javascriptphpjqueryajaxjeditable

Send a variable to a Jeditable function


I'm using Jeditable plugin for editing contacts in my webpage. Problem is that I have to send a contact name through Jeditable function to an php handler.

This is a value i want to send to pro_handler.php

$contact = $_GET['contact'];

This is an Jeditable function that im using to handle textarea

    $(".editable_textarea").editable("inc/pro_handler.php", { 
                        type   : 'textarea',
                        select : true,
                        submit : 'OK',
                        cancel : 'cancel',
                        cssclass : "editable",
                        id   : 'elementid',
                        data : 
                        name : 'newvalue',
                      });

So I want to somehow pass a $contact variable to pro_handler.php somehow and I have no idea how to do this. Thanks


Solution

  • From the doc: (Mixed) submitdata: Extra parameters when submitting content. Can be either a hash or function returning a hash.

    So, you could do the following.

    $(".editable_textarea").editable("inc/pro_handler.php", { 
        type : 'textarea',
        select: true,
        submit: 'OK',
        cancel: 'cancel',
        cssclass: "editable",
        id: 'elementid',
        name: 'newvalue',
        submitdata: {"contact": "the_value_to_be_sent"}
    });