Jump to content

php ajax multipart form data using method get


gongpex

Recommended Posts

Hello everyone,

it's possible or not to use 'GET' method to send data from ajax multipart form data like this :

var formData = new FormData( $("#fm")[0]);

$.ajax({
  type : "GET",
  cache: false,
  contentType: false,
  processData: false,
  url : "<?php echo base_url('index.php/update/do_update');?>",
  dataType : "json",
  data : formData,
  success : function(response){
  	alert('posted');
  }
});

Currently I used method 'POST' to send data, but it cause pending / stalled on XHR so all the process aborted.

Q1 : if the method must be 'POST' only , could you tell me the solution to avoid pending on ajax request?

Q2 : does the hosting provider have potential to influence the process? (currently I use free hosting to hosting my website)

Please help me, because I can't upload anything if the process still pending / stalled.

Thanks

 

Edited by gongpex
just add something left behind
Link to comment
Share on other sites

You can use get for small data sets, but browsers will enforce a limit on the length of a URL.  Using post also makes sure that all of your form data is not saved in whatever log between your browser and the server that might save a URL.  

if the method must be 'POST' only , could you tell me the solution to avoid pending on ajax request?

I'm not sure how to answer that, because I doubt the problem is using post.  I would look up all of the options you're using for that request to verify that everything is correct.

Link to comment
Share on other sites

Hello

Thanks for reply.

Today when I asked my hosting provider about why my ajax upload process is pending / staled they answered me :

"are you using script to sending data? it's probably blocked by free hosting BOT blocked"

Q : is this possible the main cause why my ajax process pending / stalled ?

because when I run my code (used post method) on localhost it able to sent as well.

please reply

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...