Jump to content
Sign in to follow this  
gongpex

php ajax multipart form data using method get

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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...