I'm a newbie web developer diving into Backbone for the first time. One major question I've been grappling with (actually spending a lot of the last 2 days researching to no avail) is how exactly Backbone communicates with the server.
In my previous projects, I've been able to fetch data from my database using PHP and jQuery's $.getJSON method. I'm also able to do this when I use Backbone (ex. myCollection.url = "todos.php"). However, in every single tutorial, documentation, example code I've looked at, the url for the collection is always set as a directory and the urlRoot is directory/id (ex. myCollection.url = "/todos" and myModel.urlRoot = "/todos/5".
My question is how exactly is this managed? It seems a lot cleaner than the traditional way I was doing by adding GET parameters to my calls. At first I thought this was routing, but that seems to be only related to setting browser history and stuff. Some of the source code I've looked at uses SLIM PHP and Rails (neither of which I've used) but I have no clue how any of the parts fit together.
Backbone has its own api for communicating with server, such as fetch, save, destory.In fact, these methods do the same things with jQuery's $.ajax. For example, you use backbone's fetch in this way:
var UserModel = Backbone.Model.extend({
url : "rootURL/user",
});
var user = new UserModel;
user.fetch(
data:{
userId : 1, //the webservice will be: rootURL/user?userId=1 GET;
}
success:function(model, response, options){
//callback
},
error:function(model, response, options){
//callback
},
);
But you can also use the same way as in the jQuery to communicate with server in backbone's application.For example:
var UserView = Backbone.View.extend({
render: function(){
//do something
}
getUser: function(userId){
$.get("rootURL/user",
{ userId : userId},
success:function(data){
//callback
}
);
}
});
Related
I tried to do these three simple things but I can not in a world to figure out in almost ONE MONTH already, one word---FRUSTRATION! Now I doubt if emberjs is really worth it...
I want to:
Get data from database with just a .php file and data will be in json format
NOTE: I did this, in other SO question I asked, so I will not repeat.
Now, the problem, how can I save those data in a "store" without ember data?
Is there any available tutorial on how php can connect with emberjs? I tried to read about its REST adapter, but seem it needs some type of JSON API. Do I need to develop a JSON API if I use pure PHP code as back end?
If anything part is not clear, please reply in comment! Thanks a lot.
Chen, to be honest it is very easy to handle data without ember-data . I have used it few times, some of which were related to building quite large front-end systems. Main reason, ember-data was not that stable at the time and did not inspire much confidence. The other reason is that as you will see it is pretty straightforward.
All you have to do is create a class (it is also nice to have a singleton ember controller) that will get data from the server and post data to the server. The data format should be JSON, to make all process easier and clearer. You achieve this by using simple ajax calls,
function retrieveData(callback){
jQuery.ajax({
url: *yoururl*,
timeout: ajaxTimeOut,
success: function(data){
/* here you store this data somewhere
it could be helpful to have a callback that you call so that this class/controller
is not coupled with specific logic*/
if(callback!=null){
callback(data);
}
}
});
}
The function for retrieving data can be called when the associated route gets called or from the controller of that route. The callback function passed to the previous class/controller will set the data retrieved to some properties of the controller, or it could even be its model. Simple example,
http://emberjs.jsbin.com/AsOcAbU/1/edit
js
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.IndexRoute = Ember.Route.extend({
/*model: function() {
return ['red', 'yellow', 'blue'];
},*/
setupController:function(controller,model){
this.controllerFor('myJSON').findJSONData(function(data){
controller.set('model',data);
});
}
});
App.IndexController = Ember.ArrayController.extend({
});
App.MyJSONController = Ember.Controller.extend({
findJSONData:function(callback){
var data = ['red', 'yellow', 'blue'];/*this will come from the server with an ajax call i.e. $.ajax({...})*/
if(callback){
callback(data);
}
}
});
hbs
<script type="text/x-handlebars">
<h2>Welcome to Ember.js</h2>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
{{#if model}}
<ul>
{{#each item in controller}}
<li>{{item}}</li>
{{/each}}
</ul>
{{else}}
loading ....
{{/if}}
</script>
In the context of complete application you will probably need to iterate the json data and create ember objects out of it. That is really simple as well thanks to ember,
http://emberjs.jsbin.com/oWetaDuH/1/edit
/*let's say you retrieve color objects from php*/
findJSONData:function(callback){
setTimeout(function(){
/*this will come from the server
with an ajax call i.e. $.ajax({...})*/
var data = [{color:'red'}, {color:'yellow'}, {color:'blue'}];
if(callback){
callback(data);
}
},2000);//mimic ajax call
}
/*and you need to use ember magic bindings, so you have your own objects to represent the domain model*/
App.MyColor = Ember.Object.extend({
color:null
});
/*then the code for retrieving will become*/
setupController:function(controller,model){
this.controllerFor('myJSON').findJSONData(function(data){
var myColors=[];
data.forEach(function(jsonColor){
myColors.pushObject(App.MyColor.create(jsonColor));/*this is all you need to create the ember object !!*/
});
controller.set('model',myColors);
});
}
and hbs
<script type="text/x-handlebars" data-template-name="index">
{{#if model}}
<ul>
{{#each item in controller}}
<li>{{item.color}}</li>
{{/each}}
</ul>
{{else}}
loading ....
{{/if}}
</script>
update
If it is required to pause routing until the model is resolved, then promises should be used as explained in the guides
http://emberjs.com/guides/routing/asynchronous-routing/
In this case, since jQuery ajax function returns a promise, the previous example could look like,
http://emberjs.jsbin.com/mogicira/1/edit
js
App.IndexRoute = Ember.Route.extend({
model:function(controller,model){
return this.controllerFor('myJSON').findJSONData(function(data){
var myColors=[];
data.forEach(function(jsonColor){
myColors.pushObject(App.MyColor.create(jsonColor));
});
return myColors;
});
}
});
App.IndexController = Ember.ArrayController.extend({
});
App.MyJSONController = Ember.Controller.extend({
findJSONData:function(callback){
return $.ajax({url:""}).then(function(data){
data = [{color:'red'}, {color:'green'}, {color:'blue'}];
if(callback){
return callback(data);
}
});
}
});
If you like ember & ember-data it should be for the less-code and code maintenance between other not less important concerns
If you feel comfortable with php, move your php code to a modern FrameWork for not reinventing the weel and in order to obtain similar benefits that ember done to your front-end
I'm developing an ember app feeded with Codeigniter http://ellislab.com/codeigniter and codeigniter rest service https://github.com/philsturgeon/codeigniter-restserver but I don't recommend you this combination
I my opinion you should try Laravel http://net.tutsplus.com/tutorials/php/laravel-4-a-start-at-a-restful-api/ or directly go to Rails/Rails-API
I'm migrating an old MS-DOS Foxpro program to cakePHP, but in some part of the application process the user will have the possibility to load a text file and process it according to some business logic.
I worked the algorithm, and it's working fine, I programmed it in plain PHP.
But in some parts of the process the user must interact performing some tasks, in plain PHP it's possible to do it.
My question is:
How can I have an interactive file process on a MVC framework, since the controller had processed the data when it`s give the control to the view.?
jQuery-ajax could help?
What do you think?
Regards
Update
As Borislav Sabev pointed, I do this:
Create a file upload using using: jQuery Form Plugin
A PHP file parsing according the data structure on the uploaded file that returns to the client the parsed contents of the file in JSON.
Then the JSON data is sent for processing via ajax POST
$.each(data, function (i, fb) {
callAJAX(fb);
});
callAJAX just send the POST request
function callAJAX(fb){
$.ajax({
type: 'POST',
url: "proc.php",
dataType:"json",
complete: function(r,st){
},
success: function(r,st){
processError(r);
})
},
async: false
});
}
If there is a translation error, the PHP returns to the client an error message via JSON.
function proccessError(r)
{
$.each(r,function(i,d){
if (d['error'] == 1){
$.alert('Material not found in translation table','Error');
}
})
}
Now the big question:
When I open the $.alert dialog I want the user select the correct material via an autocomplete, but the code is no waiting for the user selection and pops another $.alert window. How can I tell jquery to wait to the user input an then continue with the processing?
BTW: this is the $.alert extension that I use:
$.extend({ alert: function (message, title) {
$("<div></div>").dialog( {
buttons: { "Ok": function () { $(this).dialog("close"); } },
close: function (event, ui) { $(this).remove(); },
resizable: false,
title: title,
modal: true
}).text(message)
.parents(".ui-dialog:eq(0)").wrap('<div class="error-w"></div>');
}
});
What #AD7six told you is completely right however your question is very vague.
What you seem to need is to provide an interactive (realtime?) way for a user to edit data after a files has been uploaded and processed?. If it is 'data arranged in rows' I can suggest some DataGrid - imagine this as a Web representation of your file's structure.
What you're trying to say with 'the view shows the result of a method or action on the controller' is that this case is in the normal HTTP (with MVC) flow:
Browser (user) initiates a request => Request is processed my Controller => Model is called (gets, saves or manipulates data) => Data is returned to Controller => Controller handles the data over to the View layer => The view layer renders, Controller returns the Response (the rendered view)
In order to do this thing interactively you will have to use AJAX (I propose AJAJ).
The overall paradigm in this case is that the above flow is iterated on every AJAX request. You can achieve this in many ways:
Use plain JavaScript and XMLHttpRequest
Use jQuery's XMLHttpRequest wrapper functions ($.ajax(), $.post(), $.get(), $.load(), etc.)
Some other JS lib's AJAX capabilities (MooTools for example)
Use an real-time JS app framework
This also heavily depends on the browsers (and versions) you need to support.
You will need to provide 'access' for the client-side via a controller or a full API. The best solution for an API would be REST. If this is an enterprise app I suggest you adhere to the Richardson Maturity Model.
If you don't need a fully-realtime app I'd go with jQuery AJAX or some other JS lib's AJAX.
The thing is that what you request as an answer is an overall explanation and that is why I am not going to provide code examples.
Cake has JSON views that you can use to return data.
The other option is an empty layout and a view that returns JSON encoded data like:
<?php echo json_encode($data);?>
Hope this helps. If anything ask.
I'm working on a PHP / AJAX application and it's quickly becoming unmanageable!
The application is designed to work much like a a desktop application so almost every user action results in an AJAX call.
For every one of these actions I have some jQuery that posts the data to my PHP script and runs a corresponding PHP function that handles the server side actions.
That means in my jQuery file i'll have something like this:
$('.delete-project').on('click', function(){
// Ajax request to http://myapp.co.uk/ajax/delete_project
});
$('.delete-user').on('click', function(){
// Ajax request to http://myapp.co.uk/ajax/delete_user
});
$('.delete-keyword').on('click', function(){
// Ajax request to http://myapp.co.uk/ajax/delete_keyword
});
I'm sure there is a better way of doing things, but how is it generally done to avoid lots of similar code? The above actions could possible rolled into one 'delete' ajax request which posts the item type and a database ID but a lot of my functions post different data and require different parameters so wouldn't fit so neatly under one jQuery handler.
I've tried finding some resources on how an AJAX application should be put together but all I can find is beginner tutorials on making AJAX requests etc, not how to write a scalable AJAX application.
Just to be clear I know how AJAX works, I'm just trying to find the best way of implementing it in terms of reducing the jQuery and PHP needed where possible.
Are there any good resources that deal with this sort of thing?
You can roll all those into one delete function by using attributes in HTML, for example:
$('.delete').on('click', function(){
var delete = $(this).attr('data-delete');
// Ajax request to http://myapp.co.uk/ajax/delete_{delete}
});
Then your HTML would be something like:
Delete
More information on data-attributes
Not sure if this would help but you could create some functions to reduce your code as it grows. For starters you could prevent duplicating of the ajax call by putting the jQuery .ajax function in a custom wrapper function of your own. For example:
function ajaxGet(myUrl, queryString, successCallback, errorCallback) {
if(queryString) myUrl+= "?" + queryString;
$.ajax({
url: myUrl,
type: "GET",
data: null,
success: function (res) {
if(!successCallback) return;
else successCallback(res);
},
failure: function (res) {
if(!errorCallback) return;
else errorCallback(res);
}
},
By creating a wrapper function, you can pass in the needed data without duplicating the $.ajax call code over and over in each of the click functions. You can also create a similar function for an ajax call using post. You could then dynamically build the click functions to further reduce your code:
function buildClicks() {
setupClick([url], [data], [success], [error], [$(elem)]);
setupClick([url], [data], [success], [error], [$(elem)]);
setupClick([url], [data], [success], [error], [$(elem)]);
}
//Setup clicks for each button or link
function setupClick(url, data, success, error, elem) {
elem.click(function () {
ajaxGet(url, data, success, error);
});
}
In this example I'm assuming your using a "GET" and adding a query string. You could easily adapt this to pass, a JSON formatted object for example, using a custom "POST" function. In that case [data] would be an object not a query string.
Sorry this code isn't the clearest. Let me explain it a little more. The buildClicks function would allow you to setup multiple click events on different elements by passing in the required data. I'm not sure if you are passing any data, but the above functions would allow for it. By dynamically creating the clicks you can avoid duplicating the .click code over and over. Just call the buildClicks function on document ready as such.
$(document).ready(function () { buildClicks(); });
NOTE: The success and error callbacks are functions that will be executed when your call either completes successfully or errors out. If you do not wish to use these they can be ommitted or null can be passed in. Make sure if you do pass in functions that you leave off the "()" on the end of the function name. Otherwise the functions will be executed prior to the success or failure of the ajax call. For example:
ajaxGet("http://testurl.com", null, ajaxSuccess, ajaxFailure);
ajaxSuccess() {
}
ajaxFailure() {
}
You could set an ID attributes to that buttons and a class like submit-button.
Then hang a handler on that $('.submit-button') while using an ID attribute value to define the URL to call, like that:
$('.submit-button').on('click', function(){
$action = $(this).attr('id'); //lets say the ID's value is 'delete_project'
$url = 'http://myapp.co.uk/ajax/' + $action;
// Ajax request to http://myapp.co.uk/ajax/delete_project is done
});
Anyway any web application that tends to be like a desktop one is only a bunch of JS and few HTML with some PHP behind... That is always badly maintanable...
I used [extJs][1] once for this, which led to using only jQuery and their modules while no (or just a minimum of) HTML was needed to write...
Not a copy-and-paste-solution, but maybe you find some more ideas how to build a scalable client-server application when looking for how REST APIs are built. I find REST a very good structure to keep a clear server-side API when building such apps, and i'm sure there are tutorials around how to do the corresponding client-part cleanly too.
In my application I do quite a lot of ajax calls too. I found that the easiest way to do things was to create myself a wrapper for all ajax calls such as:
var MySite = function()
{
AjaxWrapper : function(type,url,data,callback,noloading)
{
$.ajax({
type: type,
url: url,
data: data,
success:function(json)
{
if(json.status === true)
{
if(typeof callback === 'function')
{
callback(json);
} else {
// A generic success handler
}
} else {
// An error handler
}
}
});
};
}();
then you'd call it like:
MySite.AjaxWrapper("GET", "somehref", {}, function(json)
{
// json has the result of your json callback
// you could also make this a separate function
// or not have it
});
this let's you call your ajax on just about anything you want. You could then use something like data attributes, or just the standard href for anything that requires ajax and add an event to all links that pass through this function. Or, if you wanted some to do certain things just make the callback function different for those.
I'm finding this hard to explain, but this is what I've used for a couple of ajax-rich projects and it makes things so much easier!
For an example for your case you could then use something like:
$('a[class|="delete"]').on("click", function()
{
MySite.AjaxWrapper("POST", $(this).attr("href"), {param:number1}, DeleteHandler);
});
The way I would do this would be to have a single function for all actions:
$('.actions').on('click', function (e) {
e.preventDefault();
var action = $(this).data('action'),
id = $(this).data('id');
$.get('/local/handler.php', {
'action': action,
'id': id
}, function () {
// Callback stuff here
});
});
And HTML:
Delete Project
Delete User
Delete Keywork
And the PHP file should have if statements based on the action parameter that performs the requested action.
EDIT:
This way your not limited to just delete actions, so you can scale your app in the future.
Also, If the different actions become a large list (e.g. deletes of many kinds, updates, adding), I would create a separate PHP file for each action and include them in one master file. This will allow for easy scaling.
I am using AngularJS 1.0, PHP, and mysql with localhost on my Mac.
I have a very simple mysql database: "cats". It has one table called "kittens". The table has two columns, "id" and "name". There are three kittens in the database with names Larry, Curly, and Moe.
Now, I have some simple PHP code which opens the dbase, gets the three records, and returns them in JSON like this:
[{"id":"1","name":"Larry"},{"id":"2","name":"Curly"},{"id":"3","name":"Moe"}]
I used the latest angular-seed and set up a project in Eclipse. In app.js I wrote this:
'use strict';
angular.module('Cats', ['ngResource','Cats.filters', 'Cats.services', 'Cats.directives'])
I put my PHP code in the services folder and named it "index.php". If I navigate to that services/index.php in my browser using localhost on the Mac, I get back the JSON above. So far everything is cool.
Now - ALL I WANT TO DO (!famous last words ;) is connect to the PHP service I have and display the contents of that Cats table on my main index page using my AngularJS project. Plain old text, no tables, just bind to the available resource and display it.
I have tried all manner of demos online (many are out of date). Can anyone show me one simple, current way to do this? For the life of me I have all kinds of AngularJS demos working but none of them does this simple task in a way I can understand.
Thank you in advance.
This should also work. It's significantly fewer lines of code, but note that any error handling has been removed:
function FetchCtrl($scope, $resource) {
var services = $resource('../services/index.php');
$scope.data = services.query();
}
FetchCtrl.$inject = ['$scope', '$resource'];
Normally I would have used the built in .get() method on the $resouce but your response is in the form of an Array, which .query() supports by default.
You can find the documentation on $resource here
OK. Solved it. First, copied and added a controller I found in one of the examples:
function FetchCtrl($scope, $http, $templateCache) {
$scope.method = 'GET';
$scope.url='../services/index.php';
$scope.fetch = function() {
$scope.code = null;
$scope.response = null;
$http({method: $scope.method, url: $scope.url, cache: $templateCache}).
success(function(data, status) {
$scope.status = status;
$scope.data = data;
}).
error(function(data, status) {
$scope.data = data || "Request failed";
$scope.status = status;
});
};
$scope.updateModel = function(method, url) {
$scope.method = method;
$scope.url = url;
};
}
Then, I added a route controller to my module:
var module = angular.module('Cats', ['ngResource','Cats.filters', 'Cats.services', 'Cats.directives'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/main', {templateUrl: 'partials/partial1.html', controller: MyCtrl1});
Finally, on that partial1.htm page, I added this:
<div ng-init="fetch()">
{{data}}
</div>
Now when I go to that page in the browser, I can see the entire database dumped out in JSON. Ahhhh. Clearly there are many more sophisticated things to try, etc etc but I needed this simple result so I could be certain that I did in fact have a model arriving when summoned. Angular dies silently in many cases, so a visible result was quite helpful.
One gotcha: be careful that the php file is executable by more than yourself as user. I don't know the name of the user that AngularJS implements but I had to chmod 644 index.php so the app could use it.
I hope that helps someone.
I'm trying to get an understanding of how Backbone.js, Slim PHP and Paris/Idiorm might work together and I'm having trouble completing the flow, starting with model attribute data, all the way to the database. PROBLEM: What exactly gets sent to my server when I do model.save() ?
Client-side: Backbone.js
var Donut = Backbone.Model.extend({
defaults: {
name: null,
sparkles: false,
creamFilled: false
},
url: function() {
return '/donut';
}
});
var bostonCream = new Donut({
name: 'Bawston Cream',
sparkles: true,
creamFilled: true
});
bostonCreme.save(); // <-- Problem: Not sure what & format this is sending
I think the above is my main problem. My understanding is that backbone will by default, know to send POST data since it's new. It sends it to /donut which is routed, but the question I have is WHAT does it send? And in what format? The outcome I want is to save those donut attributes to my DB. I can pass this server-side code a json like this using jQuery $.post()...
var myDonut = {"name":"Jelly Filled", "sparkles":false, "creamFilled":true};
$.post('http://localhost/donut', myDonut);
...and it happily takes it, saves it to my database. But with the current setup trying to send my backbone donut data, I get POST 500 Internal Server Error. Below I have some server-side code.
Server-side: Slim PHP w/ Paris
class Donut extends Model {}
$app->post('/donut', function() use ($app) { // Slim framework routes my POST...
$donuts = Model::factory('Donut')->create(); // Paris stuff...
$donuts->name = $app->request()->post('name'); // Slim request parameters...
$donuts->sparkles = $app->request()->post('sparkles');
$donuts->creamFilled = $app->request()->post('creamFilled');
$donuts->save(); // Paris... Save name, sparkles, and creamFilled to my DB
});
I have a feeling the answer is out there, but every example I've looked at seems to be missing one piece of the puzzle or another and I can't get that "A-hA!" moment. I thank you in advance and apologize if this is a really ignorant question. :-P
FOLLOWUP/EDIT: 1
Can you paste the error messages?
I get a POST http://localhost:8888/donut 500 (Internal Server Error) in the current state. I can get more information with the following code.
bostonCream.save({}, { // REPLACE bostonCream.save();
success: function(model, response) {
console.log('SUCCESS:');
console.log(response);
},
error: function(model, response) {
console.log('FAIL:');
console.log(response);
}
});
Now when I run backbone's save(), I still get the 500 Error but also XMLHttpRequest as my FAIL response. The only remarkable clue from the XMLHttpRequest is responseText = SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null.
So my guess is that either 1) I'm messing something up with the save() in that it isn't capturing my attributes correctly, 2) It is currently sending my attributes in a format that my server isn't recognizing with the standard $app->request()->post() Slim methods (Doesn't seem to do much when I try accessing directly with $_POST either), 3) My server isn't setup correctly to take the kind of data that is being sent.
Another thing I noticed although I don't know what to make of it is that when I add
echo $_POST;
It returns to me an empty array. Still gives me the FAIL. If I do THIS however...
echo json_encode($_POST);
It gives me a SUCCESS and the response is a [ ]. Nothing in there. Clearly my POST data is still wonky.
I came up with a solution to completing the problem: how to get data from client to server using the default backbone save() and .sync - passed over to the Slim php framework and going through Paris/Idiorm to my DB.
I am including my working updated code below:
Client-side: Backbone.js
var Donut = Backbone.Model.extend({
defaults: {
name: null,
sparkles: false,
creamFilled: false
},
url: function() {
return '/donut';
}
});
var bostonCream = new Donut({
name: 'Bawston Cream',
sparkles: true,
creamFilled: true
});
bostonCream.save();
/***** If you want to check out the response to save() ? ***
bostonCream.save({}, {
success: function(model, response) {
console.log('SUCCESS:');
console.log(response);
},
error: function(model, response) {
console.log('FAIL:');
console.log(response);
}
});
************************************************************/
Sever-side: Slim PHP w/ Paris/Idorm
class Donut extends Model {}
$app->post('/donut', function() use ($app) {
$donuts = Model::factory('Donut')->create();
/* EDIT: Works... but not the Slim way
$parameters = json_decode(file_get_contents('php://input'), true);
$donuts->name = $parameters['name'];
$donuts->sparkles = $parameters['sparkles'];
$donuts->creamFilled = $parameters['creamFilled']; */
/* SLIM: Using Slim Request Object */
$requestBody = $app->request()->getBody(); // <- getBody() of http request
$json_a = json_decode($requestBody, true);
$donuts->name = $json_a['name'];
$donuts->sparkles = $json_a['sparkles'];
$donuts->creamFilled = $json_a['creamFilled'];
$donuts->save();
// echo json_encode($parameters); // Prove you've captured POST data, send it back
}
Now my code is happily using the default settings of Backbone.js (no changes to sync) and sending proper model attribute information to my server which seems to be successfully accepting the data and saving it to my DB.
The key here seems to be this line...
/* $parameters = json_decode(file_get_contents('php://input'), true); */
// EDITED: getBody() method not documented in Develop Doc, only Stable # time of post
$requestBody = $app->request()->getBody();
If you want to know "what exactly is sent to the server", you should have a look at the Backbone.sync function in Backbone's code. It is very well documented, step-by-step. Then, the cleanest way to achieve what you need is to write you own sync function, inspired by Backbone's sync.
Also, a quick way to see what is sent to the server is to use your browser debug console (Network tab). You can compare here what is sent by Backbone vs. what is sent when you use $.post directly. Please post this information if you need more help !
backbone sends json data to your php backend server, which you should expose your RESTful api to respond to http verb like get, post, put, delete and etc.
your backend api is responsible for communicating with database.
I am not sure about SLIM PHP. it seems to handle the request. Can you paste the error messages?