0

I want to pass JavaScript array to PHP using ajax. the status in Network is 200 and everything is ok but i got erorr Here is the code. data is array:

$.ajax({
    type : "POST",
    url: '?r=site/mahsulat',
     dataType: "json",
        data : JSON.stringify({ 
        'arra' :arr
    }),

    success :  function(data) {
        alert(data);
      window.location = '?r=site/mahsulat' 
    },
    error : function (data){
        alert('Error');
    }
11
  • Can you show what is the error? Commented Apr 4, 2017 at 13:22
  • i'm gettin error alert Commented Apr 4, 2017 at 13:24
  • console.log the data in the error callback Commented Apr 4, 2017 at 13:26
  • you mean : error : function (data){ console.log(data) ; } Commented Apr 4, 2017 at 13:29
  • yes, exactly :) Commented Apr 4, 2017 at 13:29

1 Answer 1

1

you do not need to stringify your object. just send your object without stringify that.

Sign up to request clarification or add additional context in comments.

1 Comment

damet garm dadash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.