What does the crossDomain:false parameter in Ajax mean?

Asked

Viewed 772 times

5

I’m implementing an image upload web application on Ajax and there is the parameter crossDomain:false in an example finding. What is the function of this parameter?

  • 1

    Cross: cross, Domain: domain. Cross domains, imagine as if it were the interaction between two different domains.

  • 1

    If you are fetching a file that is in another domain, this is called "cross Domain".

  • @Sergio I understood, but there is the need to put crossDomain:false? The standard is true? I did not understand the difference in the practice of this parameter, if I let true by default will bring some harm or this is just to make something explicit?

  • @Orion if you put here the link to this plugin/option we can see in the source code referred to the "crossDomain".

  • @Sergio at the end of the page contains the code https://github.com/sigurdga/django-jquery-file-upload/blob/master/fileupload/templates/fileupload/picture_basic_form.html

  • 1

    @Orion, ok. And seeing more above I find the plugin url fileUpload. I’m running out of time now, but take a look here (https://github.com/blueimp/jQuery-File-Upload) and enter the answer. If I don’t do it myself or someone else afterwards.

Show 1 more comment

1 answer

4


In the Jquery concept, the parameter crossDomain:false sets the behavior if redirects between domains occur on the page called by the method. For example:

  • www.dominio.com/pagina.html invokes Ajax method: www.dominio.com/servico.ashx.
  • www.dominio.com/servico.ashx returns HTTP 302 Found pointing to shop.dominio.com/servico.ashx.

Case crossDomain:false, this Ajax call automatically fails.

Case crossDomain:true, this Ajax call is allowed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.