Johnny
asked on
how to get info saved to database (my code is not working)
im gonna do this short as maybe i messed it up and i'm not seeing the problem.
alert(signaturePad.toDataU RL()); alert fires fine. doesn't seam to be running the save_to_mysqli.php file
how can i debug this to find out if its working, and or is there something wrong with code i'm using.
i am trying to use jquery inside javascript i have jquery loaded with <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></s cript>
the code of
what am i missing that this is not working please
thank you in advance for any code or help you may provide.
alert(signaturePad.toDataURL());
// ** Save to database how **//
/**/
//e.preventDefault();
//var name = $("#name").val();
var image_info = signaturePad.toDataURL();
var dataString = 'image='+image_info+'';
$.ajax({
type:'POST',
data:dataString,
url:'save_to_mysqli.php',
success:function(data) {
alert(data);
}
});
alert(signaturePad.toDataU
how can i debug this to find out if its working, and or is there something wrong with code i'm using.
i am trying to use jquery inside javascript i have jquery loaded with <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></s
the code of
if (jQuery) {alert("jQuery library is loaded!");} else {alert("jQuery library is not found!");}
fires off finewhat am i missing that this is not working please
thank you in advance for any code or help you may provide.
Do you have a link to look at?
ASKER
jQuery is JavaScript. Please show us the PHP that is in this script:
save_to_mysqli.php
save_to_mysqli.php
In this function
saveButton.addEventListene r("click", function (event) {
You are passing the object as event but later on you are targeting just e
e.preventDefault();
This should be
event.preventDefault();
saveButton.addEventListene
You are passing the object as event but later on you are targeting just e
e.preventDefault();
This should be
event.preventDefault();
ASKER
@Ray_Paseur
<?php
// version:
//'save_to_mysqli.php
$link = mysqli_connect("localhost", "local_xxxx", "xxxxx", "local_xxxxx");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
//mysqli_query($link, "CREATE TABLE myCity LIKE City");
$query = "INSERT INTO signatures VALUES (NULL, 'FakeName Johnny', '".$_POST['image']."', NULL, '".$_SERVER['REMOTE_ADDR']."', NOW(), NULL)";
if (mysqli_query($link, $query))
{
printf ("New Record has id %d.\n", mysqli_insert_id($link));
}
else
{
//printf("query failed: %s\n", mysqli_error());
//echo "error need to find out how to print mysqli error";
throw new Exception(mysqli_error($link));
//exit();
}
/* drop table */
//mysqli_query($link, "DROP TABLE myCity");
/* close connection */
mysqli_close($link);
?>
ASKER
@GaryC123
e.preventDefault();
is commented out is it need for the function to operate and also changed to event.preventDefault();?
e.preventDefault();
is commented out is it need for the function to operate and also changed to event.preventDefault();?
In the page you linked to it is not commented out.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@ GaryC123
that was it i had the wrong path for the save file..
i dont think i would have ever od found it thank you
that was it i had the wrong path for the save file..
i dont think i would have ever od found it thank you
ASKER
thank you again