Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

64
Views
Replace variable of Wordpress shortcode based on select box?

Is it possible to do this without Ajax, solely with vanilla JS and PHP?

What I am trying to do is:

  • Return the shortcode in PHP (easy)
  • Show it on the page (easy)
  • Allow users to select a text on the front-end (HTML is easy, but how do I send this as a variable?)
  • Change the shortcode variable with the chosen text on the front-end and load it dynamically on the page.

My question is: what options do I have? Is it solely Ajax or can I do this with PHP and JS-only?

function place_function() {
   
     return '[myshortcode place="new york"]';
}
7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs