开发者

JQuery: loadcrossdomain and ajax

Here's how I am loading things at http://atipico.com.br

  • First, JQuery via Google API

  • Then I load form another 开发者_C百科domain two global functions: loadcrossdomain (that uses getJSON via query.yahooapis) and a simples function for url parse

  • Google Analytics

  • Then I load via loadcrossdomain function the html file containing the form (which is in another domain); and I also define some variables that will update two form's input hidden fields to be submited when the form is sent

  • Then I load the javascript code that makes the ajax when the submit form is clicked (from another domain)

  • Then comes the body and all the rest

Odds:

  • The html code of the form doesn't appear in the code of the page when I ctrl+u in Firefox or Chrome

  • The page navigates straight to the php page that was assigned in the form (and in the ajax)

  • Most of times when I insert an alert before the form.js (which has the code to make the ajax), everything works perfectly

So I came to the conclusion that there is something in the code that is not being loaded in the right time. And I guess that the alert are somehow delaying it, giving some seconds so that everything is loaded just fine.

What I have already tried

To put

<script type="text/javascript">try{jQuery.ready();}catch(e){}</script>

in the end of the page but it with no effect.

  • To load the form file via ajax/php

What I got till now

  • If I include the form code in the html page (instead of load it from another server) everything works fine.

  • Believe or not, this same code used to work before.

Thanks for any help


Well, it looks like no one had nothing to say. I choose to insert the content I was trying to include via JS directly in the html body. And it dix the ajax issue and so one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜