jquery - No response for success call after form submiting -
i'm making simple contact form send each message don't see response after function success i.e. message mail sent.. errors.. etc. js
var submitcontact = $('#submit'), message = $('#msg'); submitcontact.on('click', function(e){ e.preventdefault(); var $this = $(this); $.ajax({ type: "post", url: 'contact.php', datatype: 'json', cache: false, data: $('#contact-form').serialize(), success: function(data) { if(data.info !== 'error'){ $this.parents('form').find('input[type=text],textarea,select').filter(':visible').val(''); message.hide().removeclass('success').removeclass('error').addclass('success').html(data.msg).fadein('slow').delay(5000).fadeout('slow'); } else { message("thank you!"); message.hide().removeclass('success').removeclass('error').addclass('error').html(data.msg).fadein('slow').delay(5000).fadeout('slow'); } } }); });
and form
<form id="contact-form" method="post"> <div class="row"> <div class="col-md-4"> <input class="form-field" name="name" id="name" type="text" placeholder="name"> </div> <div class="col-md-4"> <input class="form-field" name="mail" id="mail" type="text" placeholder="email"> </div> <div class="col-md-4"> <input class="form-field" name="subjectform" id="subjectform" type="text" placeholder="subject"> </div> </div> <div class="row"> <div class="col-md-12"> <textarea class="form-field" name="messageform" id="messageform" rows="6" placeholder="message"></textarea> <div class="submit-area"> <button type="submit" id="submit" class="button button3">send</button> <div id="msg" class="message"></div> </div> </div> </div> </form>
why <div id="msg" class="message"></div>
doesn't display anything? i've received emails in inbox form working..?
general request url:http://example.com/contact.php request method:post status code:200 ok remote address: ip response headers response headers view source connection:keep-alive content-length:0 content-type:text/html date:tue, 28 jun 2016 09:40:19 gmt keep-alive:timeout=5, max=5 server:apache request headers view source accept:application/json, text/javascript, */*; q=0.01 accept-encoding:gzip, deflate, lzma accept-language:en-us,en;q=0.8 connection:keep-alive content-length:220 content-type:application/x-www-form-urlencoded; charset=utf-8 host:example.com origin:http://example.com referer:http://example.com/contact.html user-agent:mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) chrome/51.0.2704.84 safari/537.36 opr/38.0.2220.31 x-requested-with:xmlhttprequest form data view source view url encoded name:fsdfsdfdsfsd mail:my@email.com subjectform:fsfsdfsf messageform:fsdfdsfds
Comments
Post a Comment