troubleshooting Question

send an array with jquery $.ajax

Avatar of Veljean
Veljean asked on
JavaScriptAJAXjQuery
15 Comments1 Solution5212 ViewsLast Modified:
Hi,
I want to send an array to my Webmethod using $.ajax but i dont know how to do it, any ideas?

this code just doesnt works...i think i sending wrong the parameter coord
var coord = new Array(6)
        coord[0] = "-103.090833|21.470278"
        coord[1] = "-103.073056|-103.073056"
        coord[2] = "-103.039722|21.453889"
        coord[3] = "-103.165556|21.434722"
        coord[4] = "-102.976944|21.434722"
        coord[5] = "-102.971667|21.475278"
              
              
       
        $.ajax({
          type: "POST",
          url: "Controles.aspx/GetWebService",
          contentType: "application/json; charset=utf-8",
          data: "x:'"+coord+"'}",
          dataType: "json",
          success: function(msg) {
            AjaxSucceeded(msg);
          },
          error: AjaxFailed
        });
ASKER CERTIFIED SOLUTION
Barry Jones

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros