javascript - Why this ajax call is not working? -



javascript - Why this ajax call is not working? -

$(document).ready(function(){ $('.clickthetext').click(function(){ $.post("submit.php", $("#formbox").serialize(), function(response) { $('#content').html(response); }); homecoming false; }); });

my target pass content form , edit info , show response @ current page.

.clickthetext button content:

<div class="clickthetext">click here see result</div>

content within id #formbox: part of form within id. rest of form out side id processed later. content/input within of id "formbox" processed.

whatever response get, show within of "#content" id.

what doing wrong here?

----edit----

i didn't add together on submit.php show response, wrote there:

<?php echo 'somthing blah blah blah something'; ?>

maybe there problem result of submit.php

you can seek calling

$(document).ready(function(){ $('.clickthetext').click(function(){ $.ajax({ type: "post", url: "submit.php", data: $("#formbox").serialize(), success: function(response) { $('#content').html(response); }, error: function(jqxhr, textstatus, errorthrown) { console.log(textstatus, errorthrown); }, datatype: datatype }); homecoming false; }); });

instead , more detail of result of ajax call.

here's api ajax object in jquery

javascript php jquery ajax

Comments

Popular posts from this blog

c# - ASP.NET MVC Sequence contains no matching element -

java - Parsing XML, skip certain tags -

rest - How to invalidate user session on inactivity in a stateless server? -