i need to pass $(this).data into success func in ajax. here is my code But $(this).addClass(‘wishlist-comp-saved’); is not working inside success: function(data) {} Answer $(this) will change context when called. When inside of the success: function (data), $(this) is not the same as it was inside of whatever is calling this $.ajax() request. For your issue, you simply have to
Tag: ajax
Receiving data in php via AJAX (inside WordPress)
I have a php function that needs to receive data via AJAX. This is my code: Javascript php The issue is that the searchstring from the AJAX call is not received inside the php function (the received string is empty). Can anybody help me? Answer well your main problem is that none of the data you are sending via ajax
Retun data from a Django view after a javascript AJAX POST request
I am using Javascript to send an asynchronous request to a Django View. The View is able to receive data from the POST request, but I can’t seem to return a message to confirm that everything worked. I was expecting that xhttp.responseText would contain the message Thankyou, but it is empty. The html part looks like this: The javascript looks
Convert AJAX Jquery to Vanilla Javascript (POST) with .fetch async
I am trying to change this .ajax call from Jquery to pure Javascript. And this way I receive the JSON in my PHP: echo ‘{“enviando”:-1,”cat”:”<span class=text-primary><strong>’ . $exampleresult . ‘</strong></span>”}’; JQUERY CALL: And this is my try with Vanilla Javascript: But I get the error: SyntaxError: Unexpected end of JSON input at envSoli. And the error line: let resultado =
Javascript in WordPress won’t work because of AJAX form
For a client, I was using a form built with Formidable Forms plugin. In Elementor, I added this piece of code: This code worked perfectly fine and the SVG was inserted. However, after changing the form to an AJAX form, the code above is no longer working. Does anyone have any idea on how this Javascript can be working in
Does anyone know how to print a message/value if a condition are met in Ajax on Laravel?
So, here is the code If the code is ran, then in the has_physical_outlet and has_online_marketplace column will show either 1 or 0 (data taken from a form). Which in this case, I wanted change it so that it will show either message of “yes” (if the data itself is 1) or “no” (if the data is 0) in the
Ajax call from click event issue
Look at the HTML code below: Now I want to trigger the file upload and call to ajax on the click by .upload-button. This is how I tried it in jQuery, But, this code not working for me. That mean it didn’t send the ajax request. Hope somebody may help me out. Answer I think you’re mixing up a trigger
ajax call to delete a server file returns html of current page
I want to use a click to delete eror_log file on server In the code below why I’m getting html of currently viewing page as a response? This happens regardles error_log exists or not I’m expecting empty string as a response aa.php Answer In the code below why I’m getting html of currently viewing page as a response? Because that
Problem with ajax price update when changing options
I got a problem on a Prestashop website (1.7.7.8) , with updating price when changing options. In some particular cases, an error occured and the price is not displayed. You can see the bug here : https://bacom.lebonweb.fr/accueil/32-bache.html This append in a specific scenario, when we have several options ; and not all are availables for all others options (not sure
jQuery ajax call is returning response data as String instead of Object
On the following StackBlitz: https://stackblitz.com/edit/react-jbthdw?file=src%2FApp.js I have a code which fetches a JSON data with a list of names. There are two ways of returning data: Axios and jQuery. With the Axios approach the code works properly. Now, because some business decisions I need to replace Axios with jQuery. My problem is: with jQuery the response.data is fetched as string