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.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);
		    }
		    });

Open in new window


alert(signaturePad.toDataURL()); 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"></script>
the code of
if (jQuery) {alert("jQuery library is loaded!");} else {alert("jQuery library is not found!");}

Open in new window

fires off fine
what am i missing that this is not working please
thank you in advance for any code or help you may provide.
JohnnyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Do you have a link to look at?
0
JohnnyAuthor Commented:
http://completelocal.info/sig/sig.php

its the save part im having issues with
0
Ray PaseurCommented:
jQuery is JavaScript.  Please show us the PHP that is in this script:

save_to_mysqli.php
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

GaryCommented:
In this function
saveButton.addEventListener("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();
0
JohnnyAuthor Commented:
@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);
?>

Open in new window

0
JohnnyAuthor Commented:
@GaryC123

e.preventDefault();

is commented out is it need for the function to operate and also changed to event.preventDefault();?
0
GaryCommented:
In the page you linked to it is not commented out.
0
GaryCommented:
You've amended the page now but now you have

404 Not found - http://completelocal.info/sig/save_to_mysqli.php
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnnyAuthor Commented:
@ 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
0
JohnnyAuthor Commented:
thank you again
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.