Possible Duplicate:
How to use split?
I'm trying to create a dynamic content div based off of a plugin. By default, the plugin takes the slides object and breaks it up at the commas. Each string after every comma is separated. However, when returning a value via AJAX, it is being interpreted as one long string instead of being broken up. How can I get jQuery to split it into multiple strings?
The Ajax:
$.ajax({
url: 'backend/index.php',
data: {'check':'true'},
type: 'POST',
async: false,
success: function(data) {
var carousel,
el,
i,
page,
slides = [ data ];
}
};
The current data being returned:
echo "
'<strong>Swipe</strong> to know more >>><br>Or scroll down for <em>Lorem Ipsum</em>',
'1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.',
'2. A robot must obey the orders given to it by human beings, except where such orders would conflict with the First Law.',
'3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws.'
";
exit();
The default example for slides:
slides = [
'<strong>Swipe</strong> to know more >>><br>Or scroll down for <em>Lorem Ipsum</em>',
'1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.',
'2. A robot must obey the orders given to it by human beings, except where such orders would conflict with the First Law.',
'3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws.'
];
For reference, this is using the SwipeView plugin found here: http://cubiq.org/swipeview