JQuery .Post after javascript: submit_contact ()

I’m trying to submit a little contact form.

Here is my jquery to POST:

    function submit_contact()
            $.post("http://www.domain.com/wp-content/themes/toronto/handlers/contact.php", {
            contact_text: $("[name='contact_text']").val(),
            contact_email: $("[name='contact_email']").val(),
            }, function(data){
            console.log( data );


Here is my html that handles the form:

Everything seems to look ok but the form is not submitting. I’ve run the .php file through a regular submit and it works fine.

Any thoughts?

You need to declare your function outside of $(document).ready()
and then call it using anything.

Why can’t I ?

As Local Variables cannot be accessed from outside, similarly local functions cannot also be accessed.

Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » JQuery .Post after javascript: submit_contact ()

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录