zeion's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
20 (0.02 per day)
Joined:
23-September 12
Profile Views:
1,479
Last Active:
User is offline Mar 18 2013 07:56 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   zeion has not set their status

Posts I've Made

  1. In Topic: How do I send data to server after a button is clicked?

    Posted 17 Mar 2013

    This API was given as a snippet for another assignment that was given at school where we only had to implement the server side PHP. It was implemented as a port server and no HTML pages were served, we just had to tally data from making queries to Tumblr API and making updates to our database.

    So for example for the assignment I would do a curl -X POST [...] request and the server would update the database accordingly.

    Like this:

    1) Server is started, index.php is ran and REST API object is created
    2) HTTP request is made
    3) REST API handles the request and updates the database
    4) Finished and repeat

    But now I wanted to actually make a functioning website with the snippet where the server would serve HTML pages to the browser on request (and also handle POST requests made by those pages).

    Now the problem is:

    1) Server is started, index.php is ran and REST API object is created
    2) GET http://localhost/ request is made
    3) API handles the request and serves main.html
    4) Client is looking at main.html, API object is not there anymore (?)
    5) Client navigates to menu.html through a link in main.html and clicks on check out
    6) Client browser sends a POST request to server, but the REST API is not there to handle it

    So.. I'm not sure if I should even be using this API for this kind of service?
    How are these kinds of sites usually implemented with PHP?
  2. In Topic: How do I send data to server after a button is clicked?

    Posted 16 Mar 2013

    Sorry I left out this part:
    This is the code for index.php that is the response when the browser queries http://localhost/
    
    <?php 
    require_once 'rest_api_food.php';
    
    $api = new REST_API;
    //$api->processAPI();
    ?>
    
    
    


    ... which creates an instance of the REST API and then the API serves main.html.

    But I still don't understand how to have the REST API be able to respond to a button click POST from menu.html?
    Do I need to somehow create an instance of REST API when menu.html is loaded?
  3. In Topic: Nothing loads when I open a HTML file locally;including jQuery library

    Posted 16 Mar 2013

    Thanks!
  4. In Topic: Nothing loads when I open a HTML file locally;including jQuery library

    Posted 16 Mar 2013

    Thanks that seems to have solved it; but is there a way to see what libraries are loaded through Firebug or some other way?

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

zeion hasn't added any friends yet.

Comments

zeion has no profile comments yet. Why not say hello?