Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

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 03-07-2013, 03:28 PM   PM User | #1
bigbada
New Coder

 
Join Date: Feb 2011
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
bigbada is an unknown quantity at this point
ajax beginner help

I need to use ajax request, that sends the current picture to the server with the help of asynchronous call. Then on the server with a php script it counts the number of black and white cells on the table field. The result then comes back to the site and shows up in an alert window. So for example if i color 10 cells black and then press the button "Prestej" i must get with the help of ajax the result in a alert window (saying 10 black and 246 white). Do you maybe know how to do that? I have never used ajax, so i would appreciate the help.

Here is my code:
code.zip
bigbada is offline   Reply With Quote
Old 03-07-2013, 03:39 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 952
Thanks: 7
Thanked 98 Times in 98 Posts
WolfShade is an unknown quantity at this point
It used to be that you couldn't upload files via AJaX; now HTML5 has formData. Google "formData" and go that route - or you could use an iframe to upload the file with.
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Old 03-07-2013, 03:43 PM   PM User | #3
bigbada
New Coder

 
Join Date: Feb 2011
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
bigbada is an unknown quantity at this point
Hmm, I think you have misunderstand me. I dont have to upload any file. Just send via ajax the picture so that the php script can count the colors? Or am I thinking something wrong here?
bigbada is offline   Reply With Quote
Old 03-07-2013, 04:38 PM   PM User | #4
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 952
Thanks: 7
Thanked 98 Times in 98 Posts
WolfShade is an unknown quantity at this point
Unless I'm missing something, you can't "send" the picture to the server without uploading it. Unless you mean to read the file and parse the binary bits on the client-side, then send that as a string to the server. In which case, that's above my paygrade. (If it can be done.)
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Old 03-07-2013, 11:25 PM   PM User | #5
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
are you sending a table of data or an image?
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 03-08-2013, 11:55 AM   PM User | #6
bigbada
New Coder

 
Join Date: Feb 2011
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
bigbada is an unknown quantity at this point
Well, i suppose a table of date.. That way it is easier than with a picture or ? I tried some example from w3school, but it doesnt really work.
bigbada is offline   Reply With Quote
Old 03-08-2013, 04:47 PM   PM User | #7
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
well, you could put the color values into form controls and submit the form to your php script, or you could use javascript to collect the values and use ajax to send them to PHP.

if you post the code you have, we can help you get it working up to the point it hands off to PHP, at which point you'll need to move the discussion to s server-side forum.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me 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 05:56 AM.


Advertisement
Log in to turn off these ads.