|
I will disappoint you : You can't do that
BUT you need not do that !
Think of the php page as a black box which can ONLY return a return string to the requesting javascript.
That is : the javascript via the URL "thinks" that it requests a page from the server. The requested page (php) is executed and with the echo (or the print) statement it can send back text. This text received can be anything you like - anything the php programmer has designed. And this text is received in the
XMLHttpRequestObject.responseText .
And this responseText IS THE ONLY VIEW that you can have from you AJAX request to the php : php variables are NOT visible / accessible by the javascript.
If all you want is to do your job then why do you worry. Or is it just curiosity?
Send a message if there's anything else I can give a hand. I wish you good luck.
|
|
|
|
|
Im doing this as a project for university. This is part of a log in script for a content management system...the whole validation of an email and sending back a variable etc...
As you can see Im learning Ajax and can do quite a bit with it already but im struggling to understand this bit of it. The part I dont get is that if my 'responseText' object contains my variable then why cant I get at it in any other way than outputting it to the screen. If I dont output it in my "innerText ='result';" statement then its still within result.
In my mid there must be a way of accessing the contents of 'result'...Maybe not, I dont know.
Anyway, thanks for your time and efforts on helping me out with this. I really appreciate it.
|
|
|
|
|
Hello I am back again (I went to bed that's why I didn't answer this - you see I am in time zone GMT +2 ).
NOW I SEE WHAT YOUR PROBLEM IS :
The value you receive in responseText you DON'T HAVE TO DISPLAY IT !
For instance you can 'say' :
var result = XMLHttpRequestObject.responseText;
if (result==1)
document.getElementById(div).style.visibility='hidden';
else
A last comment regarding your project : Things that can/must be done AT SERVER put them in the php script, while those that need the user's update and response hndle them with Java after returning from AJAX.
My wishes for success. I ll check my mail again in about 6 hours. If there anything else, send a message.
Cheers
|
|
|
|
|
The way Ive kind of got this working is to do this:
var result = XMLHttpRequestObject.responseText;
targetDiv.innerHTML = result;
if (targetDiv.innerHTML == "")
{
}
Its not exactly what I want because it doesnt allow for switching based on true variables that arent errors (I cant think of an example there but Im sure you get what I mean).
So I've done as you say, I've carried out all the things that the php script has to do IN the php script (outputting any errors, sql statements etc...) and used the javascript function to do everything else. Its quite untidy code-wise but it does the trick I suppose.
Thank you for all your help. It has helped massively.
Good luck with your VB project
Bryant
|
|
|
|
|
|
|
Anybody help me
I want to Set Fixed ip in Linux machine.
Thanks
|
|
|
|
|
|
Bad QUESTION! But I won't flag it LOL
Why?
What version of Linux? I mean they are all different - for the easy GUI method - we need to know. Typically ALL LINUX has config files in the /etc file - and a google will help ya here...
But most of the GUI Linux have some sort of networking tool that let's you select your network settings similiar to windows...
when you install linux it asks you usually how you want to configure your NIC cards.
For Linux - you really need to exercise the old Web Search Skills.
--Jason
Know way to many languages... master of none!
|
|
|
|
|
|
connectivity in PHP from database mysql
and programming code with ADD,UPDATE,DELETE
|
|
|
|
|
MySQL Functions[^]
Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Don't throw catchwords! If you have a specific problem, verbalize a question! If you don't even put enough time into it, do not expect others to give an answer!
There are enough examples on the web on how to connect to a mysql-db in php. Just google for it.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
|
HI i need complete code, layout with discription for online shopping in php.
krishna
|
|
|
|
|
check out osCommerce[^] or Joomla[^], both are open source and free. You will have to customize it yourself, or purchase a template and cop out. No one will code anything for you here, you must have meant to type this link[^] instead of codeprojects'.
|
|
|
|
|
Hi every One,
I want my php script run every 10 min.I am in a shared
web hosting so i dont have permissions for config file.
i have only php and MYSQL.How can i do this.
I tried to search in web for the solutions but found answer no where.
Is it possible to run php with limited permission.
Please Guide my through this.
|
|
|
|
|
Hi,
IIRC there is a CRON service for periodic activities; check whether your provider offers CRON.
I do not know any details, I am sure Google does.
[EDIT] It is CRON, not TRON [/EDIT]
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Monday, February 9, 2009 9:34 AM
|
|
|
|
|
Hi,
I dont know whether my server has CRON or not
my server is a shared one.With limited futures.
So how do I know whether my server has corn service or not.
And what if i dont have CRON in my server.
Regards,
Pavan.
modified on Monday, February 23, 2009 12:21 AM
|
|
|
|
|
LazyDragonfist wrote: So how do I know whether my server has corn service or not.
Check the field in your backyard... if the stalk is greater then 4 feet it's harvestin' time.
LazyDragonfist wrote: And what if i dont have CRON in my server.
Check with your host.
|
|
|
|
|
An alternative is to have the page auto refresh every ten mins.
Google "meta tag refresh" or "php header refresh"
The only downside is that you need a browser page constantly open for it to work.
|
|
|
|
|
But i want the PHP code run even the client turn off the pc.
i.e; Client just call the php page once and php should run every
10 mins even if the client pc is off.
Please help me through this.
|
|
|
|
|
Then use cron - ask your provider if your not sure if they support it - AFAIK both windows n linux servers usually support it
|
|
|
|
|
Hello,
What is your opinion about this CMS? And what features do you think must have a perfect CMS?
My goal was to create a CMS with a simple user interface on one side and wide spector of possibilities on another. And to provide delevoper with clean and expendable class architecture, unlimitied layout freedom and easy way to extend.
I would very appreciate if you write me some feedback here
Link: http://lightnote.net[^]
Demo: http://demo.lightnote.net/cms/[^]
Login: demo
Password: demo
|
|
|
|
|
Looks very simple...I'll take a peak for sure.
Do your extensions support implementing things like dynami menus, breadcrumbs, sitemaps, etc:?
|
|
|
|