Php ajax updater prototype


















Updater has some options of its own apart from the common options described in the Ajax :. This does not mean it will be evaluated in the global scope; it won't, and that has important ramifications for your var and function statements. See String evalScripts for the details. The examples above all assume you're going to update the same container whether your request succeeds or fails.

Instead, you may want to update only for successful requests, or update a different container on failed requests. To achieve this, you can pass an object instead of a DOM element for the container parameter. This object must have a success property whose value identifies the container to be updated on successful requests. I have an ajax call on my index. Specifically the session stores the quantity of each product added to the session.

As soon as I refresh the page or go to another page, that session variable is back to the original quantity. The session information is saved in a MySQL database.

I do not know why the ajax script would return the correct quantity, but then subsequent pages show the wrong quantity. After clearing cookies, I added two products to the quote. It showed 1 of each. Then I went to another page and back just to make sure not using the back button but clicking a link.

I think it has to do with the http headers, since these are not sent or received in the ajax call from what I understand. Headers will be sent when the first line of output is sent to the browser. So your problem here is your debug code that is echoing output before you apply your change. On a related note, if you are using prototype. This has been my experience with them though. I store each part of the web page in variables thenconcatenate them in a template that is echoed right at the end of the script.

Keep in mind everyone here needs to make a whole lot of assumptions about how your custom session handler is programmed. An assumption of the native files based behavior is out the window.

You could do this with the code below, and you should also set the debug level of CakePHP to at least 1, maybe then you get some more information about what causes the problem. I was afraid that was causing my problems at first, until I read in some site that I should not take care of it.

What do you think? The firebug exception you mentioned could be a hint that scriptaculous is included before prototype, you should check the order, prototype must be included first of all.

Maybe that causes the problem. I am afraid, but I have no other ideas atm. I changed the order prototype was included and the error was not thrown anymore, thnks for the tip. Then I decided to read more about prototype. So, I tryed to debug the ajax request, submitting the form, by means of the Callback Options. I would like to see what is put in this.

Any other idea? By the way, many thanks for your help and the time you take to see these messages. I am still stuck with this problem. I have tryed to found any apache configuration problem or the like, but there is nothing suspicious. I had understood the post valiation was applied to 3rd party posts, but It seems cake does do the validation for enery post request, even the ones originated in the principal app.

You are commenting using your WordPress. You are commenting using your Google account. You are commenting using your Twitter account.



0コメント

  • 1000 / 1000