Closed Thread
Thread Tools Search this Thread
Unread 23rd Jul 2011, 05:32 AM   #1
The Nocrastinator.
War Room Member
 
bolaji's Avatar
 
Join Date: 2008
Location: North Carolina, USA.
Posts: 624
Thanks: 382
Thanked 200 Times in 144 Posts
Default
Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
Share on: 
fb share twitter share gplus share more share

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.
bolaji is offline  
Unread 23rd Jul 2011, 05:46 AM   #2
www.fullonlinebooks.com
 
YongC's Avatar
 
Join Date: 2011
Posts: 133
Thanks: 115
Thanked 6 Times in 6 Posts
Default
Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
Share on: 
fb share twitter share gplus share more share

You can find the answer here : w3schools.com ...

YongC is offline  
Unread 23rd Jul 2011, 06:03 AM   #3
The Nocrastinator.
War Room Member
 
bolaji's Avatar
 
Join Date: 2008
Location: North Carolina, USA.
Posts: 624
Thanks: 382
Thanked 200 Times in 144 Posts
Default
Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
Share on: 
fb share twitter share gplus share more share

Originally Posted by YongC View Post

You can find the answer here : w3schools.com ...
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
bolaji is offline  
Unread 23rd Jul 2011, 06:48 AM   #4
www.fullonlinebooks.com
 
YongC's Avatar
 
Join Date: 2011
Posts: 133
Thanks: 115
Thanked 6 Times in 6 Posts
Default
Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
Share on: 
fb share twitter share gplus share more share

To query SQL u can use Ajax combined width php,asp ...
Here : api.jquery.com/jQuery.ajax/

YongC is offline  
Unread 23rd Jul 2011, 12:36 PM   #5
Software Wizard
War Room Member
 
KabanaSoft's Avatar
 
Join Date: 2011
Location: Pittsburgh, PA
Posts: 99
Thanks: 78
Thanked 141 Times in 78 Posts
Default
Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
Share on: 
fb share twitter share gplus share more share

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.
KabanaSoft is offline  
The Following User Says Thank You to KabanaSoft For This Useful Post:
Unread 23rd Jul 2011, 12:48 PM   #6
The Nocrastinator.
War Room Member
 
bolaji's Avatar
 
Join Date: 2008
Location: North Carolina, USA.
Posts: 624
Thanks: 382
Thanked 200 Times in 144 Posts
Default
Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
Share on: 
fb share twitter share gplus share more share

Originally Posted by KabanaSoft View Post

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.
Thanks, KabanaSoft!

That's excellent.

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

Bolaji.
bolaji is offline  
Closed Thread


Bookmarks

Tags
javascript, php, seeking

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 09:11 AM.