jQuery POST 404 not found issue due to http:// -


i have script, have no issue add cart in local development machine.

in customization link: * textbox, need pass full url. e.g http://www.google.com

in local machine, have not issue add cart, in live server, in inspect show post 404 not found.

however, if remove http:// in text box, able add cart. (e.g www.google.com)

anyone wrong server or script problem?

the part catch clink below code:

var clink = getparameterbyname('clink'); if(clink != '') {     $("div.options input[name^='option']").val(clink); }     //get query string value  function getparameterbyname(name) {         name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");         var regex = new regexp("[\\?&]" + name + "=([^&#]*)"),             results = regex.exec(location.search);         return results === null ? "" : decodeuricomponent(results[1].replace(/\+/g, " "));     } 

now problem ajax add cart not working if input http://, if run in inspect mode, u can see post 404 error. other page not have issue.

local server: os: windows php: 5.4.36 apache: 2.4.10 mysql: 5.5.40

production server: os: linux (cpanel) apache version 2.2.29 php version 5.3.29 mysql version 5.5.42-cll architecture x86_64 operating system linux

ajax add cart

$('#button-cart').bind('click', function() {     $.ajax({         url: 'index.php?route=cart/add',         type: 'post',         data: $('#product-main input[type=\'text\'], #product-main input[type=\'hidden\'], #product-main input[type=\'radio\']:checked, #product-main input[type=\'checkbox\']:checked, #product-main select, #product-main textarea'),         datatype: 'json',         success: function(json) {             $('.success, .warning, .attention, information, .error').remove();              if (json['error']) {                 if (json['error']['option']) {                     (i in json['error']['option']) {                         $('#option-' + i).after('<span class="error">' + json['error']['option'][i] + '</span>');                     }                 }                  if (json['error']['profile']) {                     $('select[name="profile_id"]').after('<span class="error">' + json['error']['profile'] + '</span>');                 }             }               if (json['success']) {                 addproductnotice(json['title'], json['thumb'], json['success'], 'success');                 $('#cart-total').html(json['total']);                  $('#cart_content').load('index.php?route=module/cart #cart_content > *');             }            }     }); }); 

set header content-type: application/json on server side. still not working.

i found out post 404 issue due hosting server security policy. once disable mod_security me error no more.

nothing script. thank reply. thanks!


Comments

Popular posts from this blog

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -