The way you suggest doing this, it won’t ever be secure. If I understand you, just disabling Javascript would spoil the security.
What you’d need to do is run a script that uses an AJAX request to query for and then add data to the page, but only if the user is logged in. That would fail safe if Javascript were disabled.
However, that is also a very labor/server intensive way to do this. My suggestion would be to conditionally add the data to the page via PHP before the page is rendered at all.
Related Posts:
- Check if user is logged in using JQuery
- Is it possible to get the logged in username in a jquery script?
- jQuery AJAX form validation
- Display sortable User meta column in admin panel user’s page
- Check for user meta data at Login
- Updating User Profile with AJAX not working
- stop login if user_status equal zero
- Making the wordpress login form a jQuery dropdown
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- Trouble with WordPress Ajax Login System – 302
- SSL issues with WordPress site
- How to get all users by custom current user meta (array)?
- timeouts (ERR_CONNECTION_RESET) on seemingly random files after upgrading to HTTPS
- Recovering the table wp_usermeta from users
- animate.style on wp-login.php
- how to do display: block after user login
- Change button text with user name using jQuery after user login
- user and usermeta table not found
- wp_signon not working fine and 302 moved temporarily?
- Get selected value with PHP and jQuery
- WordPress – Security Question at Login from User’s Meta Data
- How to set time delay in javascript
- Disable button in jQuery
- Submit a form using jQuery
- Adding placeholder attribute using Jquery
- wait() or sleep() function in jquery?
- Force a default browser on my android phone using a simple html shortcut page
- Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
- Enable & Disable a Div and its elements in Javascript
- Which selector do I need to select an option by its text?
- Check if inputs are empty using jQuery
- The ‘describe’ keyword in javascript
- e.preventdefault(); not working
- user_login vs. user_nicename
- Using WordPress 3.5 Media Uploader in meta box?
- CSS not pulling in for jQuery UI dialog
- WordPress Ajax URL for function in functions.php
- Move WordPress native javascript to bottom of page?
- Getting all user metadata from user
- AJAX function returning -1
- Uncaught TypeError: Cannot read property ‘replace’ of undefined
- Is it worth updating WP admin to jQuery 1.5?
- Proper way to load a single post via Ajax?
- Ajax not firing properly using Firefox, but works in Chrome
- Get ACF value in external jQuery document
- Redirect after login based on user role (custom login page)
- Adding jQuery dependency prevents my script from enqueuing/loading
- My custom page template with is_user_logged_in() does not detect that I’m logged in
- Delete user from frontend
- Gravity Forms not loading under https, jQuery is not defined
- Share user table from WP with Drupal
- Automatic jQuery accordion from header tags
- How to deregister a jquery version for a specific page?
- Enqueuing javascript files
- How to undo deregister script and use local versions?
- Can’t load a class into WordPress post editor’s content field
- How can I check email exists via a jquery keyup()?
- How to Dynamically Load Content Into Body of Bootstrap Modal Window?
- Frontend Post with JQuery AJAX to Php Issue
- show/hide div with simple jQuery script [closed]
- Searching multiple tags and adding jQuery dependant script onto page template?
- TinyMCE 4 remove/add attributes for all images
- Validating a cloned/repeatable input (jQuery) [closed]
- Trouble adding inline style after jQuery in the footer!
- Reload wordpress shortcodes
- $.browser Undefined Seemingly Causing Faulty Page Display
- I’m trying to set the cookie to my site to button on click action ,it is working on when user logged in .When user logged out it’s not working
- Ajax form submit not working, returns 0
- Invoking Jquery in a Plugin
- Why not working jquery show() function in wordpress? [closed]
- registering new jQuery after wp_deregister_script() not working
- Displaying an image’s alt title and caption inside a fancybox window. Working, but showing the same alt and caption for each image
- Required radio button does not validate in form, when clicked through Javascript/jQuery
- Need workaround for insecure XMLHttpRequest endpoint request
- jQuery don’t working
- Applying jquery to WordPress admin edit.php
- Load different post_thumbnail for smaller window width (jQuery,WordPress)
- Duplicate “default” form with jQuery
- Checking length of string in an admin area field onblur with jQuery
- Create new user from phpMyAdmin
- Save jQuery UI Sortable on WordPress
- Why does WordPress load jQuery in my header instead of footer?
- Problem adding MP3 attachments to a jPlayer playlist
- wp_enqueue_script jquery and jquery ui not working
- is_user_logged_in function in a sidebar not working
- Axis guidelines over an image
- jquery Autocomplete
- Homepage loads many unnecessary jquery-ui files
- REST_query_vars for users
- Refresh widget admin page resetting jQuery hidden class
- Autocomplete for titles via ajax – rework of past post away from like_escape()
- Display and Allow users to edit their own profiles
- Validate user meta and redirect
- Sorting UL Listing Within the TinyMCE Visual Editor in WordPress
- My .js file is getting a 404
- Contact Form 7 submission does not complete [closed]
- how to display post in jquery slider and carousel
- Carousel Hover Image
- What is calling jquery?
- Enqueued jQuery not working