Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
$(document).ready(function ()
    {
       var results  =[1111$11,1222$22,2333$33];
        $('#bttn_Click').click(function () {
        stringArray = new Array(results);
            stringArray.split(',');   // Error display
          
            for (var i = 0; i > stringArray.length; i++) {
                stringArray[i] = stringArray[i];
               
            }
            alert(stringArray);
             var postData = { values: stringArray };
                
            $.ajax({
                type: "POST",
                url: "/AddModule/Insert",
                data: postData,
                success: function (data) {
                    alert(data.Result);
                },
                dataType: "json",
                traditional: true
            });

        });
    });
Posted
Updated 13-Jan-15 0:02am
v3

1 solution

new Array() can not get an array as parameter...It should be a list of values or nothing...
In your case results is already an array so you have 3 options...
1. Assign the existing array to the new
JavaScript
stringArray = results;

2. Clone the existing array
JavaScript
stringArray = results.slice(0);

3. Do not introduce a new aray but use the existing
JavaScript
var arrSplit = results.split(',');
 
Share this answer
 
Comments
Nishant.Chauhan80 13-Jan-15 6:17am    
thanks a lot sir...
Kornfeld Eliyahu Peter 13-Jan-15 6:22am    
You are welcome...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900