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?

4

2 回答 2

1

包括

<script type="text/javascript" src="js/mailer.js"></script>
于 2013-04-24T13:23:04.303 回答
0

确保包括

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

createDOMString 在那里定义,所以我可以放心地假设它不包含在您的脚本中;)

于 2013-04-24T13:22:29.103 回答