Get an object value in jquery or javascript and makes a post request
Date : March 29 2020, 07:55 AM
Any of those help You can associate each link with the its button by using a data-* attribute. On your button, use data-mylink="linkId" and give it the link's id. Then, on your onclick you can do something like this: $('.buttonClass').on('click', function(){
var myLinkId = $(this).attr('data-mylink');
//as David Barker suggested, you can also grab it with $(this).data('mylink')
//whatever else you have to do.
});
$('.buttonClass').on('click', function(){
$(this).parent().find('a').text() or .val() or .attr('href');
});
$(document).on('click', '.buttonClass', function () {
// your code here
});
|
Node.js created server makes 3 request on first page load and 2 request after each page refresh?
Date : March 29 2020, 07:55 AM
With these it helps This is intended behaviour. The browser actually does multiple requests by default. The second request is usually a favicon.ico request. You can log which URL was called using console.log(request.url);
|
Using FormData object in jQuery ajax request makes page redirect
Date : March 29 2020, 07:55 AM
Hope this helps The form data still find its way to the server but now the page redirects to the page in the url. I cannot figure out why at all. form.submit((event) => {
form.onsubmit((event) => {
let formData = new FormData(this);
let formData = new FormData(event.target);
|
Fetch request makes unwanted page reload
Date : March 29 2020, 07:55 AM
I hope this helps . The problem is that when your button is clicked, the form is submitting and causing the page to reload. You can see the problem in action here. function btnclick(e) {
// comment and uncomment e.preventDefault to see the differences
e.preventDefault()
}
|
If a HTTP web page makes an ajax request to a HTTPS url is the post secure?
Date : March 29 2020, 07:55 AM
|