Skip to content

Tag: php

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…

Creating an extension js inclusion problem

I am creating a small plugin with JS animation. In my plugin, I created an index.php file for my shortcode, functions.php to call my JS code and a JS file for the animation. Anyway my shortcode works, but not the animation So I called all these files in my console, it seems to tell me that I don’t have …

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 v…

JS background with Html text

I have found a js background and now I would like to have this background on all my php files. The problem is that html code goes either under js or behind it. How can I solve this? JS file: Another Php file where I included js: Css for Php file: Answer At the moment the cavas which ‘paints’ the