How to save a variable, using AJAX, a database mySQL using Coldfusion?

I have a jquery script that takes a background color of an image using AJAX. I would like to save the variable, var rgba = e.rgba () on a MySQL database. The person who created the script says to use: $.post("color.php",{rgba:reba});) to save a database with AJAX. How to save the var rgba using coldfusion to do CF?

The script:

< script >

;(Function($){

$. fn.canvasify = function (f) {/ / faster than dynamically converting one pixel at a time}

return this.map (function () {}

If {(this.nodeName=="IMG)"}

var canvas = $("< canvas >')

This.SRC = this.src / / IE fix

$(this) .one ('load', function () {}

Canvas.Attr ({width: this.width,:this.height}) height})

Canvas [0]. GetContext ('2d'). DrawImage(This,0,0,this.) Width, this. Height)

$(this) .replaceWith (canvas)

})

return the canvas [0]

} else {}

return this

}

})

}

function Rgba (rgba) {}

This.RGBA = rgba

this.toString = function() {return "rgba (" + Array.prototype.join.call (this.rgba, ',') + ")"}

}

$. {Event.prototype.RGBA = Function ()}

var x = this.offsetX | (this.pageX - $(this.target) .offset () .left),.

this.offsetY = y | (this.pageY - $(this.target) .offset () .top).

nodeName = this.target.nodeName

If (nodeName = "CANVAS")

return new Rgba (this.target.getContext('2d').getImageData(x,y,1,1) .data)

ElseIf (nodeName = 'IMG') {}

var canvas = document.createElement ("canvas")

Canvas.Width = 1

Canvas.Height = 1

canvas.getContext('2d').drawImage (this.target, x, y, 1, 1, 0, 0, 1, 1)

return new Rgba (canvas.getContext('2d').getImageData (0,0,1,1) .data)

} otherwise return null

}

(}) (jQuery)

{$(function()}

$("figure").append ("< class p =" rgba">" ")

$('img').canvasify ravishing (demo))

$('img').click (demo)

function {persons

var rgba = e.rgba (),

digit = $(this) .parent)

Figure.CSS ('background-color', RGBA). Find ("p"). Text (RGBA)

}

});

< /script >

< style >

{p.RGBA}

background: white;

color: black;

border: 1px solid red;

min-height: 20px;

}

< / style >

Here's some pseudocode

AJAX

...

$data = {RGBA: $rgba, var1 = $var1, var2 = $var2, etc.};

...

var ajaxResponse = $.ajax({)

type: 'POST',

URL: '.. '. /.. /dir/settings.CFC? Method = saveBGColor,

contentType: "application/json; charset = utf-8 ",

data: JSON.stringify ($data).

etc.

});

Settings.CFC

Tags: ColdFusion

Similar Questions

  • How to save the password encrypted in the database using database authentication (weblogic server)

    Hi Experts,

    JDEV version 11.1.1.7.0

    I have a usecase where I use database authentication in my Application.

    However if I save the module to record user password. Its economy without encryption. Can U suggest how can I do this

    Thank you

    Roy

    Please see

    https://docs.Oracle.com/CD/E16162_01/user.1112/e17455/dev_secure_apps.htm#OJDUG1168

  • How to 'Save as PDF' using Safari 5.1.7 in Windows 7?

    I use Safari 5.1.7 but can't "Save as PDF".  Y at - it a tip for that?

    THX

    You must have a software for creating PDF as Adobe Acrobat Pro or Nitro PDF for features.

  • How to save an Image on a Sql database without losing the Vision Info?

    Hello

    is it possible to save an image with the info of the vision in a Sql Server 2005 database? I tried the method of ImagetoArray and saved table in a varbinary field, but the info of the vision is lost.

    Kumi-

    You can do something like this (assuming that you already have the Image):

    imageString of object = null;
    CWIMAQFlattenOptions options = new CWIMAQFlattenOptions();
    Options. Type = CWIMAQFlattenTypes.cwimaqFlattenTypeImageAndVisionInfo;
    axCWIMAQVision1.FlattenImage (Image, options, imageString Ref);
    Byte [] imageData = imageString (byte []);

    and then imageData will hold the content of the image.  You can pass this to CWIMAQVision.UnflattenImage () to restore the data.

    Greg Stoll

    Vision R & D

    National Instruments

  • How can you save dead MacBook using FireWire for iMac? I can view all the files on iMac, but don't know how to back up before, I reinstall MacBook.

    My MacBook Pro doesn't start then you want to erase and reinstall iOS. Before doing this I want to back up all my files. If I connect to imac via FireWire I can view all the files, but how can I save it it?

    If your MacBook will start in target disk Mode, follow the instructions on how to set up and use...

    Share files between two computers with target - Apple Support disk mode

    But you do not want to share files, just to save them. You can make a "clone", using disk utility. For cloning utility purposes use a program likeSuperDuper! or double clone.

  • How to save a map to subsequently use wifi iPad offline

    How to save a map to subsequently use wifi iPad offline

    You can always make a cap of the map screen. Press the sleep and home quickly, as you will need to press the shutter of the camera down. You should see a white Flash and the cap will be saved in your photos app.

  • Satellite A300-177: how to save pictures using the webcam internal

    Hello

    I recently bought a Satallite A300-177 which comes with a web camera bulit in.
    I want to save pictures that I take with him, but it only allows me to send them a mail.

    Could someone help me how to save them or if not possible?

    Thank you very much
    Gill

    Hello

    I put t know if my advice will be useful for you as I don t have the A300, but another internal a series with the webcam.

    In my case, I have access to the software of the webcam. It appears in the taskbar.

    -Double-click and go to the settings.
    -You will find different tabs. Go to the tab called images.
    -Here, you should find the setting and the path to the images created.

    I recommend you to check the source where the created images were stored.

    Greetings mate

  • Hi whant to update the changed value to dishes of the same variable used in the entry. How to do thanks in advance

    Hi, I want to update the value out put of the same variable used in the entry. How to do thanks in advance

    ya I got it. using the property node (and if you select value) we can do. Thans for answer

  • Not able to scan. How to scan and save a document using Vista?

    Since my PC doesn't have a program Windows Fax Scan &, how to scan and save a document using Vista?

    Hello

    I suggest you to visit these links and check if it helps:
    http://Windows.Microsoft.com/en-us/Windows-Vista/scan-a-document-or-file

    http://Windows.Microsoft.com/en-us/Windows-Vista/scanning-frequently-asked-questions

    It will be useful.

  • How to save the settings of the application (variables)?

    How can I save the application settings? I have a variable, which by default is 0. User can it set to 1 if it has something to do. How it save? It is possible without e/s?

    The best place to start is SharedObject.

  • How can I configure Messenger to record my conversations, record them and send them to a location I can read and save when you use Messenger on other computers than mine?

    How can I configure Messenger to record my conversations, record them and send them to a location I can read and save when you use Messenger on other computers than mine?

    original title: Live Messenger

    Hi Nicoliani,

    To start saving your Conversations in Windows Live Messenger

    1. connect to your window Live Messenger and click on 'Tools' or click on your display name.

    2. scroll down to "Options", a window should appear. When he does very well and click on "Messages".

    3. locate "historical Message". After that, check the box that says, "automatically keep a history of my conversations.

    4. below that you will see "save my conversations in this folder."

    5. to side of her you will see change, make sure that it is a file that you can access and watch later.

    6. If you are on a network, you can save it in a directory which you have access, or you can save it to a location and later mailed to yourself and access it later.

    Where chats are saved is given below.

    1. to access the Conversations go to the start bar and click My Documents. Then click on "my received files."

    2. There should be a folder with your name on it. Click the folder, then you will be in another folder called history. Continue

    3. by clicking on the folder, now you should see all your saved conversations.

    Hope this information is useful.

    Amrita M

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to save custom cultures as presets for later use?

    How to save a custom size/resolution for later use culture?

    Thank you

    Gene

    Please follow the steps below.

    > Launch Lightroom

    > Go to the develop module and click crop

    > Click on the drop-down list format to and select enter custom

    > Once you click OK, it will get applied and added to the list itself.

    Let me know if it helps.

    ~ UL

  • How to save downloaded and open the PDF directly into my laptop, compared to saving the file in the cloud? Can I remove DC and install Acrobat Reader, which is thin and easier to use for my needs and much, much more secure?

    Somehow, I downloaded and installed Adobe alleged DC update for the existing acrobat Reader installed on my laptop.

    DC app has been a disaster for me in terms of generation of convoluted navigation and extra work.

    In addition, I do NOT trust or want an application based on a cloud because of the deep and hard-learned risk, privacy and security, as well as the occasional loss of connectivity online and access, what urgent needs can get GROUND in terms of use of such an external cloud-based application.

    Issues related to the:

    [1] how to save a PDF downloaded and open directly on my laptop, a report file to save the file in the cloud and then copying it in the folder of the laptop? This process in several steps inside the DC is a frustrating PITA, as Adobe Acrobat Reader has been sufficient for my needs.

    can [2] Alternatively, I remove CD and install the latest version of Adobe Acrobat Reader, which is thin and easier to use for my needs and much, much more secure?

    Thank you very much in advance for the help and deliberate in a timely & the readers attention. Today is Tuesday, November 3, 2015.

    Kind regards

    Stephen H. Franke

    E-mail: shfranke@hotmail... com

    Hi stephenf95557665,

    (1) you can simply save the file on your computer as allows you to save in the older version of the player, it is not necessary to register I your cloud of document.

    If you save the file to the document cloud, you will be able to access any system from anywhere.

    (2) If you still think earlier version users need, then they can probably uninstall the last being & reinstall the old version using this link http://get.adobe.com/reader/enterprise/

    Kind regards
    Nicos

  • How to save table data to save to PDF using php?

    Hello

    I have a load of data loading into a table of data in mysql table. Since I create a "save data" button to save the data in the table in pdf format. can someone help me how to save it and show me a few steps. Here is my code for the table:

    <?php
      $servername = "localhost";
      $username = "root";
      $password = "pass";
      $dbname = "ses";
       
       
      // Create connection
      $conn = new mysqli($servername, $username, $password, $dbname);
      // Check connection
      if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
      }
       
      $sql = "SELECT No, Calon, ID, Jurusan, Undi FROM candidates order by Undi desc";
      $result = $conn->query($sql);
      ?>
      <?php
      if ($result->num_rows > 0) {
      echo "<table >
    
      <tr>
      <th>No</th>
      <th>Candidate</th>
      <th>ID Number</th>
      <th>Programme</th>
      <th>Vote</th>
      </tr>";
      // output data of each row
      while($row = $result->fetch_assoc()) {
      echo "<tr>
      <td align='center'>" . $row["No"]. "</td>
      <td>" . $row["Calon"]. "</td>
      <td>" . $row["ID"]. "</td>
      <td>" . $row["Jurusan"]. " </td>
      <td>" . $row["Undi"]. "</td>
    
      </tr>";
      }
    
      echo "</table>";
      } else {
      echo "0 results";
      }
      $conn->close();
      ?>
    

    and here is the HTML for the button:

    can someone help me?

    Thank you

    Look at the script on the FPDF under 'Scripts' site below

    2002-12-25 Olivier Table with MySQL

    First you must download the file of fpdf.php since the site under the downloads"" section.

    Copy the first block of coding 'Source' from the example script and save it under-mysql_table.php

    Next copy the second code block and insert it into a new document in DW, modify the code as shown in red below and save it as pdf_output.php - make sure that the paths to include the mysql_table.php and the (fpdf.php file which is included in the mysql_table.php file) are correct.

    Also change the connection to your database in the code below.

    require('mysql_table.php');

    class PDF extends PDF_MySQL_Table
    {
    function Header()
    {
      //Title
      $this->SetFont('Arial','',18);
      $this->Cell(0,6,'Database Data',0,1,'C');
      $this->Ln(10);
      //Ensure table header is output
      parent::Header();
    }
    }

    //Connect to database
    mysql_connect('server','login','password');
    mysql_select_db('db');

    $pdf=new PDF();
    $pdf->AddPage();
    //First table: put all columns automatically
    $pdf->Table('SELECT No, Calon, ID, Jurusan, Undi FROM candidates order by Undi desc');

    $pdf->Output();
    ?>

    If you have set up properly and navigate to - pdf_output.php - it should produce a pdf of the extracted data in your database.

    A draw back is it uses mysql and mysqli - which is not an immediate problem, as long as you do not mix mysql and mysqli - as this is a stand alone page, it should be ok. (and of course as long as your server still supports the mysql extension)

  • IM using windows 8 How to save work in the creative cloud as a file CS6?

    IM using windows 8 How to save work in the creative cloud as a file CS6. Ron C

    CC 2014, save under CC, and then open it in CC and save it as CS6. See here: open projects After Effects of previous versions and re-registration in previous versions

    If you do not know how to install older versions, see this: CC help | Install, update, or uninstall applications

Maybe you are looking for