Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I have a Javascript array
e.g
JavaScript
var arr = ['1', '13', '22234'];


I read up that this can be converted using Jquery?
JavaScript
$.ajax({        
       type: "POST",
       url: "flashInsert.php",
       data: "shiftsArray:arr,
       success: function() {
            $("#lengthQuestion").fadeOut('slow');        
       }
    });

This probably seems quite a silly question.

How do I call this?
I don't know JQuery and would quite like to stop banging my head against this wall (it's making a mess!!!)

Thanks in advance!
Posted
Updated 27-Jan-13 5:48am
v3

1 solution

 
Share this answer
 
Comments
offroaderdan 27-Jan-13 12:08pm    
Hello Zoltán,
Many thanks for your reply. I have found it helpful. However I am still having problems. I don't think I am suppose to do this which is probably causing the problem. However in the Javascript function I am using the code window.location...... to get to the correct php page. The code says there is an array. however it doesn't contain anything.... I believe this is because It essentially isn't 'Posting' anything, however I cannot get to the page. Any ideas?
Zoltán Zörgő 27-Jan-13 14:35pm    
Sorry, I don't understand your issue.
1) Be aware, that window.location is an object that has some properties you can use to get the what you need. But that object is pointing to the current url. Do you want to make the ajax call to exactly the same url, as the current viewed pade?
2) data: "shiftsArray:arr, looks weird to me... what do you want to do here?
3) what does this mean: "the code says there is an array"?
4) Could you post exactly the code you are using?

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