Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Friday, March 16, 2018

cURL in Command Line

Following snippets can be used for testing RESTful API:

# simulate form submission 
curl -X POST -F 'name=test' -F 'password=123' -F 'csrf_token=abc' http://127.0.0.1:8000/login
# or
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'name=test&password=123&csrf_token=abc' http://127.0.0.1:8000/login

# post JSON
curl -X POST -H "Content-Type: application/json" -d '{"name":"title1", "role":"role1"}' http://127.0.0.1:8000/user

# plain GET
curl -X GET http://127.0.0.1:8000/user/1
curl -X GET http://127.0.0.1:8000/user

# PUT
curl -X PUT -H "Content-Type: application/json" -d '{"name":"other title1",  "role":"other role1"}' http://127.0.0.1:8000/user/1

# DELETE
curl -X DELETE http://127.0.0.1:8000/user/1

Tuesday, April 9, 2013

Delete row with jQuery and PHP

Do you want to delete a row in HTML and MySQL table with fancy fade out effect? This is the right tutorial for you assuming that you are familiar with basics of jQuery and PHP.
You make an asynchronous call to PHP script called delete.php so end user doesn't leave page when a row is deleted, instead he gets an alert box that confirms that row is deleted and the row gradually disappears.