Sunday 26 March 2017

php - post data from form that was hidden using jquery



I have a form that I had hidden using jquery which on click is displayed.I want to post data using php but on clicking submit nothing happens.see code



 


























if(isset($_POST['mailit'])) { echo"do something";}



  $('.with-click-text').click(
function(e) {
$(this).css('overflow', 'visible');
$(this).find('.click-text')
.show()
.css('opacity', 0)
.delay(200)

.animate(
{
paddingTop: '25px',
opacity: 1
},
'fast',
'linear'
);

$("#submit").on("click",function(e){

$(this).submit();

});
});

Answer



You have no element with id submit. Update your function;



....
$("input[type='submit']").on("click",function(){

event.preventDefault();
$(this).submit();

});


You can see demo here: Demo


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...