Skip to content
Advertisement

Tag: ajax

how to pass $(this).data() in ajax request

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

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

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 =

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

Advertisement