Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Feb 2011
    Posts
    19
    Thanks
    6
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".

  • #3
    New Coder
    Join Date
    Feb 2011
    Posts
    19
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,343
    Thanks
    11
    Thanked 589 Times in 570 Posts
    are you sending a table of data or an image?
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #6
    New Coder
    Join Date
    Feb 2011
    Posts
    19
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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.

  • #7
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,343
    Thanks
    11
    Thanked 589 Times in 570 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •