0

I am working on a website, and I don't like to write mail scripts again and again. I am trying this Javascript:

<script>

$(document).ready(function(){

$("#button").click(function(e){
e.preventDefault();
var arr=createDomString($("#contactForm"));
console.log(arr);
//var data=createDomArray($("#contactForm"));

$.ajax({

    type:'POST',
    url:'php/mailer.php',
    data:"datastring="+arr,
    //datatype:"json",
    success: function(d){           
        console.log("php response "+d);
    }           

});
});

});

</script>


However, I get this error

Uncaught ReferenceError: createDomString is not defined

Is there a problem with the script or am I doing something wrong?

2 Answers 2

1

Include

<script type="text/javascript" src="js/mailer.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

0

make sure to include

<script type="text/javascript" src="js/mailer.js"></script>

createDOMString is defined in there, so i can safely assume that it is not included in your script ;)

2 Comments

Is it necessary to include? Some other way to get it working?
createDomString function is define in mailer.js file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.