jquery - GET not redirecting the page nodeJS/mongo -


i have post ajax post based on button , form has it's own post. every time button clicked post made not redirect userprofile page tho calling , returning 304 it.

here script file:

 $('.removeemail').click(function() {         $.post('/removeemailpost', {usere: $(this).data('user')});         });    

here routes file:

exports.newemailpost = function(req, res) {     if(req.body.emailnew === '') {         console.log('blank');         res.redirect('edituserprofile');     } else {         user.findbyidandupdate(req.signedcookies.userid,{             $addtoset: {emaillist: req.body.emailnew}         }, function(err, userx) {             if(err) {                 console.log(err);              } else {                  res.redirect('userprofile');             }                    console.log(userx);         });          }  }; 

add type="button" attribute <button>, doesn't auto-submit form when clicked.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -