Sunday, May 29, 2022
HomeWordPress DevelopmentAJAX motion by way of direct hyperlink

AJAX motion by way of direct hyperlink


I’ve an current AJAX motion that is already outlined by the theme I am utilizing. The motion deletes a search merchandise request, and I might like to make use of it as a direct hyperlink – like an Unsubscribe hyperlink – emailed to the consumer together with the search outcomes…

One thing like the next URL: https://area.tld/wp-admin/admin-ajax.php?motion=delete_saved_search_item=&search_item_id=17 however I get a 0 on the display and a 400 Unhealthy Request within the Headers.

Principally within the JS it is outlined like this:

            $.submit(ajaxurl,
                {
                    motion: 'delete_saved_search_item',
                    search_item_id: search_item_id,
                },
                operate (response) {
                    response = JSON.parse(response);
                    if (response.success) {
                        search_item.take away();
                    }
                }
            );

so I suppose it expects a POST request, not a GET one… Is there any workaround to make this work? Like making a web page with a customized cURL that will imitate the POST type submission? Anybody achieved one thing like this? The nice factor is I did not discover any use of nonce, so I suppose this alone makes it simpler to deal with, does not it?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments