Sending data from a browser to a server and back

user18490

I am C++ developer and I haven't really followed up on any development related to the web for a very long time. I have this project I would like to implement, really as a goal to sort of catch up on these technologies. My project is this:

  • display some content in a browser (for example the content of a 3D scene using a canvas and WebGL), have a button on the page. When the button is clicked, send the data to the server (the camera position for instance), render the image on the server (using some offline high-quality rendering solution), return the image back to the browswer, and finally, display it in the canvas.

I believe I can fill up the gaps with simple things such as WebGl, canvas and HTML 5. I am familiar with some of these techniques and I can learn. Where I am completely lost is the technology that is used or needed to do things such as sending the data to a server, having them processed there, and sending some result back to the client. Now I have done some research on the Web of course, but the is SO MUCH STUFF out there, that it's just REALLY hard to know in which direction going. They are tons of libraries, APIs, bits of technologies, etc.

I am suspecting I need to use some combination of JavaScript, DOM, HTML5 ... but would appreciate if people having done that before or knowing how this should work, could point me to the right direction. I am really looking for something basic, and IF possible not using some sort of 3rd party APIs. I don't want to do something complicated just simple, send data, process, send back for display. My goal is to understand the principles, not to make something professional or super powerful. I am doing this with an educational goal in mind (to learn and understand).

I read about RESTFul but I am still unsure if this is what I need. Really if someone can either simply describes me the basic technology components that I need for this project, point me to documents, tutorials, examples, give me the name for the bits and pieces of technologies I should read about, it would be greatly appreciated.

I realize the scope of this question is very large (and that I should have done my home work before instead of having years now of knowledge to catch up on). I believe though this question can be of great interest to many. And I also promise that I will post my findings and why not my working example when I have one figured out and working.

Thank you.

cssyphus

NOT AN ANSWER, just suggestions/ideas that include code. A structured/formatted comment.

Unsure how to use/code them in C++, but this is just an issue of rendering HTML and implementing javascript code.

The essentials are:

Have jQuery lib loaded. One way is:

<head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>

Use a javascript code block for your jQuery script:

<script type="text/javascript">
    $(document).ready(function() {

        $('#mybutton').click(function() {
            var pic = $('image_selector').val();
            $.ajax({
                type: "POST",
                url: "ind.php",
                data: "img=" + pic
            })
            .done(function(recd) {
                $('#txtHint').html(recd);
            });
        }); //END mybutton click

    }); //END document.ready
</script>

I don't know how you would send a pic as a var, or how to structure that, but you get the basic gist...

On the server side, it works like this (using PHP for eg):

<?php
    $image = $_POST['img'];

    //Do something with the received image

Actually, now that I'm thinking about it, you are sending an image (something I haven't done before), so I don't think you can just send it like text or a JSON object... You may need to post it with the enctype='multipart/form-data attribute for file uploads, as you do when using a form for uploads? Just guessing.

Anyway, this is not intended to answer your question, just to give you some hints as to where to look further.


See these simplistic examples for the basics of AJAX:

A simple example

More complicated example

Populate dropdown 2 based on selection in dropdown 1

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Sending data back from a Node server to an iOS device (Using Swift)

From Dev

Sending data back from php

From Dev

Storing data locally in browser and sending to server

From Dev

Sending data back from cloud code

From Dev

POST data from browser not sending authentication header

From Dev

Sending data from a server to a client

From Dev

File sending from browser to a server which is not a web server

From Dev

Sending JSON data to a server and back via AJAX - steps involved

From Dev

sending data to particular client from twisted server

From Dev

iOS security sending data with password to and from server

From Dev

sending data to particular client from twisted server

From Dev

Java Sockets - Sending data from client to server

From Dev

Sending data from android studio app to server

From Dev

Sending data from Flask to Java Server

From Dev

Sending back data from activity to already running activity

From Dev

Sending data from Node.js back to client?

From Dev

Sending back data from activity to already running activity

From Dev

Grails controller sending weird JSON back to browser

From Dev

Java Send Data from server back to client

From Dev

Java Send Data from server back to client

From Dev

Pushing data to browser from ubuntu server

From Dev

Pushing data to browser from ubuntu server

From Java

Self referencing loop detected - Getting back data from WebApi to the browser

From Dev

how to store data in local browser & retrieve back from it

From Dev

Sending data from javascript to php using via Ajax using jQuery. How to view the data back?

From Dev

Ubuntu server sending mail from www-data

From Dev

Sending secure data from .NET to Linux server using POST?

From Dev

Sending array of data to PHP at server from vb.Net

From Dev

Ubuntu server sending mail from www-data

Related Related

  1. 1

    Sending data back from a Node server to an iOS device (Using Swift)

  2. 2

    Sending data back from php

  3. 3

    Storing data locally in browser and sending to server

  4. 4

    Sending data back from cloud code

  5. 5

    POST data from browser not sending authentication header

  6. 6

    Sending data from a server to a client

  7. 7

    File sending from browser to a server which is not a web server

  8. 8

    Sending JSON data to a server and back via AJAX - steps involved

  9. 9

    sending data to particular client from twisted server

  10. 10

    iOS security sending data with password to and from server

  11. 11

    sending data to particular client from twisted server

  12. 12

    Java Sockets - Sending data from client to server

  13. 13

    Sending data from android studio app to server

  14. 14

    Sending data from Flask to Java Server

  15. 15

    Sending back data from activity to already running activity

  16. 16

    Sending data from Node.js back to client?

  17. 17

    Sending back data from activity to already running activity

  18. 18

    Grails controller sending weird JSON back to browser

  19. 19

    Java Send Data from server back to client

  20. 20

    Java Send Data from server back to client

  21. 21

    Pushing data to browser from ubuntu server

  22. 22

    Pushing data to browser from ubuntu server

  23. 23

    Self referencing loop detected - Getting back data from WebApi to the browser

  24. 24

    how to store data in local browser & retrieve back from it

  25. 25

    Sending data from javascript to php using via Ajax using jQuery. How to view the data back?

  26. 26

    Ubuntu server sending mail from www-data

  27. 27

    Sending secure data from .NET to Linux server using POST?

  28. 28

    Sending array of data to PHP at server from vb.Net

  29. 29

    Ubuntu server sending mail from www-data

HotTag

Archive