Your answer definitely falls within the realm of AJAX. If you are using a form, try setting the onsubmit eventListener
equal to return false;
(plus any other needed attributes) like so:
<form onsubmit="return false;">
Then you send a post and parse it with PHP and depending on your desired effect, and the input of the user, you echo out a response to your waiting AJAX script, which can take the ajax.repsonseText
and depending on whether or not the response was equal to what you were looking for, you can set the desired HTML element’s innerHTML
equal to you whatever you want to without refreshing the page. More than likely something like this:
if(ajax.responseText != "error") {
document.getElementById("userInputDiv").innerHTML = ajax.responseText;
}
Related Posts:
- The_excerpt() doesn’t parse – how to change that?
- Trying to edit archive.php to only show post extract, with featured image
- Moved a website and excerpts don’t work for old posts
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- How set featured posts using checkbox in post edit screen?
- WP_Query: Why is sticky post not first item in loop?
- Display all posts from specific categories on a page
- Skip post in loop and mixin later
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- Reverse chronology of post listing
- posts page – different lengths of excerpt
- how to display full post with pagination on home page
- This AJAX Code Doesn’t Work – Looking for elegant solution
- How to add an admin function only to posts, not pages?
- How to use alternate post layout at key points in post loop?
- How to customize read more link
- Showing random content / pictures from earlier posts in a sticky post?
- Custom wp_trim_words() function not trimming right
- Allowing the SoundCloud player to appear in a post excerpt
- Converting multiple loops into one single loop with pagination
- Group posts by year in loop
- How would I get 1 latest post from a query for 5 posts?
- Display most recent post in full, excerpts of older posts
- Alternating post layout
- Check to see if specific loop has less than certain amount of posts
- Modify WP_Post before processing
- get_next_post() and get_previous_post() return wrong posts
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Display post from current category and same tag?
- Inserting custom data to the_post() during loop
- Blog post per page setting conflicting with custom WP_Query?
- get_the_excerpt() is not working as expected – returns wrong text
- Post Loop Missing Most Recent Post
- Get Image tag from content of post
- Start WP Pagination From Number 1 in URL
- Use two different post_per_page limits with infinite scroll
- How to make the first post in the loop be styled like a “new / featured” post?
- How to setup a query to output posts by groups of five?
- How to order posts in an arbitrary order?
- Wrong post title displayed from loop
- Get the amount of posts on a current page
- How to add a class to each individual post?
- How to get posts published on the latest date?
- How to disable the_excerpt from one post
- How can I remove the first two words and shorten get_the_title()
- Page and post loop same template
- ACF to select posts not displaying on blog page
- Show metabox value last post excerpt, title and link
- Loop through posts? Want to remove extra newlines in actual post HTML/content on backend
- the_excerpt is displaying excerpts of every post
- Querying another post category to match current post and display in loop
- How to display posts on custom page without declaring a posts page in reading settings?
- how to handle the loop using filling bootstrap grid structure?
- WordPress loop not working on static front page
- Custom WP_Query not working correctly
- Display specific posts on home page
- The loop starting at a certain ID
- Loop not showing first post
- posts going to 2 pages/categories only show up in 1
- Custom Post Type Single Loop Outputting Wrong Post
- Get current taxonomy and display query accordingly
- Calling Permalinks With PHP
- Shortcode for Comments and Comment Boxes in Post Loop
- Multiple post in One Loop in wordpress
- Display specific posts based on an ID of another post
- Diffrent layout for posts [duplicate]
- How to distinguish pages created by woocommerce?
- Enable HTML Tags in WordPress Post excerpt
- how to call recent post content in a loop ( only the content before read more tag)
- Show post excerpt
- Show author bio box
- Use special template for the first post in the loop
- Can the_post_navigation() be outside of the loop?
- Nothing appears using get_the_excerpt() in category.php
- WordPress infinite post cycle problem
- How to get all posts in gallery post format template
- Show Posts By Custom Field
- List of authors posts minus very latest
- Querying multiple categories in the WP loop if one of the category IDs is dynamically obtained
- show latest authors blog post
- Post gallery as carousel
- Showing content from WordPress ruins page CSS using WP_Query, without, content does not show
- Add something after all sticky posts in The Loop
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Show category post with excerpt text
- Display Post by menu order
- How can i show only 30% of the “the_content(“More…”)”?
- Getting rid of the blog page entirely
- Is there a way to separate wordpress titles from their posts?
- adding custom meta as well as looping through posts
- Redirecting posts in WordPress to a specific page
- ‘posts_per_page’ => ’10’ does not show any post
- When and how will php code in a user made WordPress page be executed?
- Query wordpress posts on static page
- Excerpt all post content Content Same Size without word cutting off
- posts_per_page – Repeats only first posts ‘post__in’ array
- View post with specific category id and name which I selected in the backend (drop-down option)
- WordPress Ajax load doesn’t work