05-23-2012, 09:16 AM
I'm trying to get this to work in Magento CMS, so need it to write the returned value (which is a phone number) into a page, but at present it is writing the phone number but on a blank page (so getting rid of everything else) I think because of the document.write
Is there anyone who can tell me how to do this so it writes the phone number in the space I put this code???
05-23-2012, 09:21 AM
You will need to have span or a div with an ID then your code would be
var phone = jQuery(".fulfiller-contact-telephone").text();
Then where you want the number to display add
Another option would be to copy the html that holds the phone number to where you want it.
05-23-2012, 09:30 AM
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
05-23-2012, 09:48 AM
Thankyou, exactly what I needed. Very much appreciated!
05-23-2012, 11:04 AM
The only time you need to use document.write to create child pages instead of using a server side script is if you are running the script in the browser itself and not in any specific web page. One such example would be a script that generates a copy of the current page source with nice links to all of the files it uses where the page to display that source is generated using a document.write statement in the userscript attached to the browser.
There is never any need for document.write in scripts attached to a web page directly.
05-23-2012, 02:40 PM