First, don’t use query_posts
.
Second…
I think this can be done with AJAX but is there a more simple method
and give me a clean URL?
PHP runs on the server. Items are “clicked” on the client machine. The only way to pass that “clicked” value back to PHP is via AJAX. Within a WordPress framework that mostly means using the WordPress AJAX API.
So, there is no more simple method than AJAX to get a “clicked” value back to PHP.
However, if your original PHP Loop prints the post body to the page and you hide it by default via CSS– ie. display:none
— then your jQuery/Javascript can then selectively show/hide content and you don’t need another request to the server at all. That may count as “more simple”, if that is an option.
I don’t know what “give me a clean URL” means in this context.
Related Posts:
- Passing a varible from jQuery to PHP
- Frontend Post with JQuery AJAX to Php Issue
- Pass request headers in a jQuery AJAX GET call
- How to send multiple data fields via Ajax?
- Jquery Ajax Posting JSON to webservice
- TypeError: $.ajax(…) is not a function?
- Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
- jQuery Form Validation before Ajax submit
- How to manage ajax calls and JSON in wordpress
- Using jQuery to delete data stored in wp_options
- How to add a ” waiting” icon for an ajax in WP frontend?
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- What is the simplest ajax upload plugin or script to be used with wordpress?
- WordPress Ajax URL for function in functions.php
- Ajax call does not activate callback function
- AJAX function returning -1
- call shortcode in javascript
- WP set auth cookie using Ajax is not saved to browser
- How to pass both action and formdata in wordpress ajax?
- jQuery AJAX form validation
- Proper way to load a single post via Ajax?
- Basic WordPress AJAX Call
- Trying to get single posts to load on the front page via ajax
- ajax call in wordpress front end
- Ajax not firing properly using Firefox, but works in Chrome
- jQuery Ajax() doesn’t work when the page is accessed as a WordPress template page
- How to load whole WordPress pages dynamically with AJAX/jQuery like this following website?
- Using wp_ajax and wp_ajax_nopriv hooks
- Creating custom AJAX requests
- How to pass jQuery ajax URL value
- Cannot access elements of json object
- Basic ajax call in WordPress
- how to get the comment ID in the front end when the REPLY button is clicked?
- Admin wp_ajax hook returning 0
- wp_ajax unauthenticated and authenticated
- WordPress ajax function parameter value not being passed
- wp_verify_nonce not working
- Tags in WordPress 3.2
- php ajax problem – weird 301 responses!
- WordPress customizer refresh screen after save
- Loading posts via AJAX in a hidden div with updated URL?
- How to get a value from PHP in Jquery through Ajax
- Not sure why wp_ajax isn’t working?
- Load created php file data via ajax
- WordPress Ajax problem with undefined url
- Correct way to write jQuery functions in WordPress
- Display data on same page as form without refresh
- Ajaxify calendar
- Intergrating agile carousel to wordpress: how to write the ajax_callback function
- AJAX Loaded Glossary like Search results with links to other entries from custom table
- How to Dynamically Load Content Into Body of Bootstrap Modal Window?
- Return an array from get_terms and store as JavaScript array for search autocomplete
- Trouble with WordPress Ajax Login System – 302
- WP http XML response HTML encoding and image display problems
- Using WP_Query to grab custom meta values, foreach to json object
- Add/remove action on jQuery toggle
- delete post meta by AJAX
- url – ajax loaded but no JS
- Ajax form submit not working, returns 0
- Creating a new div onclick wordpress+ajax
- how to json_encode(); the Loop content so that the encoded array is [“0”:content, “1”:content]
- Properly embed javascript into WP (using function.php) – doesn’t work?
- jQuery tabs plugin with callback to fetch data
- No Object Properties sending form through AJAX
- Redirect wp_dropdown_pages() to an AJax request?
- Custom AJAX form not working async
- Null/undefined return in WordPress AJAX request
- click event to unhide something after ajax not firing
- Search query with Ajax
- how to use wp_editor() here am getting empty result
- admin ajax php success returns 0
- Manipulate retrieved ajax data in php
- problems with jquery external rss feed integration
- Converting a working AJAX form to work with WordPress
- WordPress Front-End Theme Editor
- AJAX calendar navigation returns -1
- my example with ajax doesn’t work
- Get ajaxForm response value
- How to pull data from a table using wpdb?
- Is not using admin-ajax to ajax submissions okay?
- Autocomplete for titles via ajax – rework of past post away from like_escape()
- How to specify url for ajax call in wordpress plugin
- Retrieve customizer value using ajax or customizer api and print the value in theme
- WordPress version for this autocomplete jQuery code
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Ajax Request with jQuery not happening
- Page keeps refreshing with Ajax form
- How to pass more information though separate post keys via AJAX
- wp_signon not working fine and 302 moved temporarily?
- Loop not appending through infinite-scroll ajax call
- how to refresh index page without reloading browser using ajax
- Ajax request with jQuery without WP_ajax
- jQuery form plugin, submit in the wordpress way
- Contact Form 7 submission does not complete [closed]
- Using WP Ajax and jQuery to process multiple forms on the same page?
- Combo box populating a DIV using ajax/jquery
- Infinite Scroll applied to ajax loaded content
- Load loop images on click / defer image loading until click or other event
- Widget won’t work due to old JavaScript? Any ideas how to make it work? [closed]
- Contact Form 7 – Submit Form not working After Ajax Request [closed]