WordPress.org

Ready to get started?Download WordPress

Forums

Using script value in shortcode (2 posts)

  1. stecmedia
    Member
    Posted 10 months ago #

    Hi
    I am currently working on a site for a client, which needs a price generator. The pricing generator is javascript, and works like this:
    Test version
    (View the code by using your browser's source text function)

    I would now like to take the chosen values and the result and add to the shortcode for my shop-plugin, which looks like this:

    [wp_cart_button name="VALUE 1 to VALUE 2" price="RESULT"]

    This is where the shop is located, if you would like to view that as well.

    The plugin is WP Simple Paypal Shopping cart v3.8.5

    I hope this is the right forum, and thanks in advance. Just ask if you need more information, I'm here to get help ;)

  2. bcworkz
    Member
    Posted 10 months ago #

    Javascript can only pass information back to the server and PHP via some HTTP request. Either as URL parameters for GET requests or as a data string for POST requests. Any cookie values are also passed with each request.

    It's not trivial, nor necessary, to insert data passed from javascript into shortcode attributes. The passed values will be directly available from $_REQUEST or it's related super global arrays by the shortcode handler.

Reply

You must log in to post.

About this Topic