How to inject data content from external json into a modal, using UIkit?

Ok. The solution I found out, was more simple than I thought. On the script use “jQuery” instead of “$”. HTML trigger: <a href=”#myModal” onclick=javascript:openModal({{id}})><article>… </article></a> function openModal(id){ jQuery.ajax({ type: “GET”, url: ‘https://www.example.json’ + id, dataType: ‘json’, success: function(data) { var data = data.T.ads; var infoModal = jQuery(‘#myModal’); infoModal.find(‘.uk-modal-title’).html(data[0].brand + ‘ ‘ + data[0].model); htmlData=”<p>” … Read more

Get shortcode attribute for AJAX call

The problem is ordering. $srcDir is being set correctly, but when it’s set the call to wp_localize_script has already happened. Instead, consider changing your code to refer to a data attribute in the content that the shortcode returns. This also prevents the code being tied to only allowing a single instance per page. Additionally, there … Read more

Multiple Notifications SetInterval

There’s two approaches you may want to use here, depending on the notification behavior desired: To notify each user any time there are new notifications: You need to make sure your sql query returns the notifications in a sorted order (preferably with descending data timestamps) and includes a unique identifier/primary ID [PID] for the rows … Read more