Should JavaScript call Wicket.Ajax.ajax trigger page reload (Wicket v6.13)? -


I would like to send the AJAX event to the wiki panel from the browser, so that it refreshes the contents of a label. I also need to send this request to the javascript function.

Good works - Ajax request is being sent, and the updated label is included as expected:

Ajax request:

  http: // localhost: 8080 / Cyclop / Cyclop / CED 1-3.IBehaviorListener.0-historyPanel & amp; _ = 1392727280955  

And the response:?

  & lt ;? Xml version = "1.0" encoding = "UTF-8" & gt; & Lt; Ajax-feedback & gt; & Lt; Component id = "idf" & gt; & Lt ;! [CDATA [is & lt; Div id = "idf" & gt; 6 & lt; / Div> gt;]] & gt; & Lt; / Component & gt; & Lt; / Ajax-feedback & gt;  

The problem is, I can also see another request in the Network Monitor: it gets the contents of a full page does not reload this page, just get its contents is.

What is the reason? Is this normal? Edit: I could test it a bit deeper: The wicket triggers two Ajax requests:

  1. Local hosts : 8080 / Cyclop / Cyclop / ced 2 - This is a return full page
  2. Local Host? 15111 / Cyclop / Cyclop / CED 2-11.IBehaviorListener.0-historyPanel - an ajax response

links on here code:

Ajax request A part of the HTML page:

  
  • = "Cq-tabHistory" & gt; My link & lt; / Div & gt; & Lt; / Li & gt;
  • and the JavaScript that registers the callback callback:

      $ (".cq-tabHistory"). ("Click", function () {wicket ajax.axex ({"u": link, "c": comp}}}}  

    Enter the AJAX callback on this server panel The wicket panel is square

      label counter, public historyPanel (string id) {super (id), counter = new label ("counter", new imodel & lt; string & gt; ) {@Override public string GetObject () {count ++; return count + "";} @Override public void setObject (string o) {} public @Override zero different () {}}); add (a Untr); CounterksetOutputMarkupId (right);} public void init () {browserCallback = new AbstractDefaultAjaxBehavior () {protected void response (last AjaxRequestTarget target) {target.add (counter);}} add; (browserCallback) ;. browserCallbackUrl = browserCallback.getCallbackUrl () toString ();} @Override public void renderHead (IHeaderResponse response) {super .renderHead (response); response.render (OnDomReadyHeaderItem.forScript (browserCallback.getCallbackScript ()));}  < / Pre> 

    I found the problem.

    My custom javascript function is called a wicket component on the back-end at such a request:

      Wicket.Ajax.ajax ({"u": ". / Ced ? 2-1. I.B. Deviar Listener 0-HistoryPanel "," C ":" historyPanel17 "});  

    In JavaScript to use this URL, I custom Java script calls the function will set the global JavaScript variable - this method render Head (IHeaderResponse response ) My component is not so strange anymore ....

    The problem was that I have received a callback URL very quickly - in the manufacturer - Abibrate default Ajax Behavior After creation. As a result, 1-0.IBehaviorListener.0-historyPanel - This URL contains the wrong version of my component (its set to 0). browser callback. GetCallbackUrl () to Renderhed (IHeaderResponse response) to be transferred - in this case it is also true component ID and the correct version


    Comments