Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-01-2009, 02:29 AM   PM User | #1
sionice
New Coder

 
Join Date: May 2009
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
sionice is an unknown quantity at this point
Javascript + PHP Question

I don't think this will be too difficult to do, but I'm working on a project where a user will be uploading a file to my server. I'm not at my machine right now that has code, so I apologize for that, though I'm simply curious, on a simple level what needs to be done.

1) I have a user inputting information into a lightbox, and have the "submit" click captured in javascript. (using a jquery lightbox btw).

2) I have a function that I'm going to have to either call or move over, or whatever is easiest, that handles all the communication with our server/database. This function is in PHP.

What's the best way to do something like this,
Code:
// syntax is probably wrong, but don't worry about that
$(#mytag).click (function(){
        // I'm here in my .js
        ohhaiPHPFunction();
});
Thanks in advance =)
sionice is offline   Reply With Quote
Old 06-01-2009, 05:11 AM   PM User | #2
sionice
New Coder

 
Join Date: May 2009
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
sionice is an unknown quantity at this point
I'll post that I understand the difference of how the javascript is client side code, and the PHP runs server-side. So really, what's the general approach when I have a popup in a lightbox, and need to initiate a server side upload of a file from there?

I've seen sites do this through a lightbox before so I know it's possible to do without reloading the page. Anywho, thanks.
sionice is offline   Reply With Quote
Old 06-01-2009, 06:37 AM   PM User | #3
sionice
New Coder

 
Join Date: May 2009
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
sionice is an unknown quantity at this point
So, as Mr. Internet pointed out. Ajax via jquery is probably the way to go to do this. Thanks me, appreciate the help! =)
sionice is offline   Reply With Quote
Old 06-01-2009, 12:49 PM   PM User | #4
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
AJAX and plain javascript (neither JQuery, nor other frameworks) is probably the best way. But this is another topic
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 06-02-2009, 01:32 PM   PM User | #5
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
http://www.w3schools.com/Ajax/Default.Asp
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 10:24 AM.


Advertisement
Log in to turn off these ads.