Async Loading of Custom Posts

I have a wordpress page template, where I’m loading custom posts. The code for fetching these custom posts looks as follows: template-parts/content-page.php <article id=”songs”> <?php get_template_part( ‘partials/content/custom’, ‘songs’ ); ?> </article> partials/content/custom/songs.php $args = array( ‘posts_per_page’ => 0, ‘offset’ => 0, ‘category’ => ”, ‘category_name’ => ”, ‘orderby’ => $orderBy, ‘order’ => $order, ‘include’ => … Read more

Where’s my JSON data in my incoming Django request?

I’m trying to process incoming JSON/Ajax requests with Django/Python. request.is_ajax() is True on the request, but I have no idea where the payload is with the JSON data. request.POST.dir contains this: [‘__class__’, ‘__cmp__’, ‘__contains__’, ‘__copy__’, ‘__deepcopy__’, ‘__delattr__’, ‘__delitem__’, ‘__dict__’, ‘__doc__’, ‘__eq__’, ‘__ge__’, ‘__getattribute__’, ‘__getitem__’, ‘__gt__’, ‘__hash__’, ‘__init__’, ‘__iter__’, ‘__le__’, ‘__len__’, ‘__lt__’, ‘__module__’, ‘__ne__’, ‘__new__’, ‘__reduce__’, … Read more

include antiforgerytoken in ajax post ASP.NET MVC

I am having trouble with the AntiForgeryToken with ajax. I’m using ASP.NET MVC 3. I tried the solution in jQuery Ajax calls and the Html.AntiForgeryToken(). Using that solution, the token is now being passed: var data = { … } // with token, key is ‘__RequestVerificationToken’ $.ajax({ type: “POST”, data: data, datatype: “json”, traditional: true, … Read more

Allow AJAX call to other roles than admin

On my website, registered users (subscriber role) can send drafts and, if admins validate them, they are published. I’m trying to add a tag box to frontend editor used to send new posts. To implement the autocomplete feature I’m making an AJAX call to this URL: http://example.com/wp-admin/admin-ajax.php?action=ajax-tag-search&tax=post_tag That works great for an administrator user, but … Read more

console.log(result) returns [object Object]. How do I get result.name? [duplicate]

This question already has answers here: How to return the response from an asynchronous call (43 answers) Closed 5 years ago. My script is returning [object Object] as a result of console.log(result). Can someone please explain how to have console.log return the id and name from result? $.ajaxSetup({ traditional: true }); var uri = “”; … Read more

Why would admin-ajax.php redirect to the home page for logged out users?

I am using the wp-polls plugin on my website. This plugin relies on using AJAX requests of the form http://www.myfakewebsiteurl.com/wp-admin/admin-ajax.php?action=polls&view=process&poll_id=2&poll_2=8&poll_2_nonce=420d75e659 When I log in, this request works fine: it pulls the poll results from the server, and then displays them on the desired web page. However, when I log out, this request redirects me to … Read more

WooCommerce: Translation lost on AJAX call in Checkout page [closed]

Closed. This question is off-topic. It is not currently accepting answers. Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic. Closed 7 years ago. Improve this question I’m using WooCommerce … Read more