Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?

by 5 replies
6
Hi guys -

How would one go about writing a web app that lets you:

1. Pick a bunch of HTML code from a list
-ex- sections of a sales page.
Pick a headline option...
an intro paragraph option...
a closing paragraph option, etc.

2. Click submit, and get a line of javascript that you can use to embed that HTML code on any page

I'm a programming noob... but I'd love to know how to do this for an application idea I have.

Thanks for your ideas!

Bolaji.
#programming #javascript #php #seeking
  • You can find the answer here : w3schools.com ...
    • [1] reply
    • Thanks, Yong.

      I'm actually interested in finding someone to build this for me.

      Since I'm not a programmer, even though it might be simple I don't want to take on the responsibility of managing the code, ensuring it is bug-free, etc.

      I'm thinking there may need to be some SQL as well:
      I'll want to keep track of which options were selected by each user.

      For example:

      Yong C selected:
      - Headline 5
      - Opening paragraph 3
      - Middle paragraph 5
      - Closing paragraph 2
      - Signature 1

      all of that became his sales page.

      But I'll want to track the:
      - number of views he gets on that sales page, and
      - number of clicks on the call-to-action link
      - and present him with those stats in an admin section on my site.

      That way, he can come back, reconfigure his choices after a while, and then sit back and compare the relative improvement.

      So maybe this introduces an SQL (MySQL) component... for storing the paragraph options and tracking views+clicks?

      Thanks for your help!

      Bolaji
  • To query SQL u can use Ajax combined width php,asp ...
    Here : api.jquery.com/jQuery.ajax/
  • basically all you need to do is to put the html code you want to output inside a script tag that has document.write's for each line of html you want to include.

    Ex:

    <script type="text/javascript">
    document.write("<p>my html code</p>");
    document.write("<span>more html code</span>");
    ...ect...
    </script>

    This would have to be generated dynamically based on what the user chooses to include, so you will have to have some sort of PHP script that will output this javascrit code.

    You can also do the same thing using PHP using the echo command.

    Hope this helps.
    • [ 1 ] Thanks
    • [1] reply
    • Thanks, KabanaSoft!

      That's excellent.

      I haven't the slightest idea how to do the PHP part though.

      Bolaji.

Next Topics on Trending Feed