Sunday 15 February 2015

Jquery Ajax popup form not sending data -



Jquery Ajax popup form not sending data -

i have pop form not seem send on submit info jquery. doing wrong? script create popup

<script type="text/javascript"> $(document).ready(function() { $('.popover-markup>.trigger').popover({ html: true, title: function() { homecoming $(this).parent().find('.head').html(); }, content: function() { homecoming $(this).parent().find('.content').html(); } }); }); </script>

the form populated in popup

<div class="popover-markup"> <a href="#" class="trigger btn btn-success">add genre</a> <div class="head hide">add genre</div> <div class="content hide"> <form method="post" action="" id="genreupdate"> <div class="form-group"> <select class="form-control"> <?php foreach($allgenres $key=>$value) { ?> <option value="<?php echo $key; ?>"> <?php echo $value;?> </option> <?php } ?> </select> </div> <button type="submit" class="btn btn-default btn-block">submit</button> </form> <div class="footer hide">test</div> </div>

jquery send info table

<script> $(document).ready(function() { $("genreupdate").submit(function(e) { var genreid = $('#genreupdate').val(); alert(genreid); var user = <? php echo authcomponent::user('id'); ?> ; var targeturl = 'http://www.website/users/update'; //alert(targeturl); .popover-markup('destroy'); $.ajax({ datatype: "html", type: "post", data: { genre_id: genreid, user_id: user }, evalscripts: true, url: targeturl, success: function() { // handle finish event var result = "thanks updating fans"; $("#genreupdated").fadeout(2000).html(result); $(".genreid").val(''); document.location.reload(); } }) }); }); </script>

i click on submit nil happens.

just change:

$('#genreupdate') => $(".popover-content #genreupdate")

like:

$(".popover-content #genreupdate").submit(....);

and places use:

$('#genreupdate')

jquery ajax forms popup

No comments:

Post a Comment