在我的代码中,我试图操纵一个字符串:
Some text - 04.09.1996 - 40-18
Run Code Online (Sandbox Code Playgroud)
我想这分为三个子:Some text,04.09.1996,和40-18.
当我使用Split方法以连字符作为分隔符,返回值是四个字符串的数组:Some text,04.09.1996, 40,和18.如何使此代码如上所述工作?
谢谢.
我正在使用 Flickr 的 API。我正在异步加载一些图像和相关元数据。我有一个脚本来完成所有这些,使用三个 AJAX 调用:
$(document).ready(function() {
var latLon = {
lat: 38.736946,
lng: -9.142685
};
var numero = 10;
var clicked = 1;
$("#sq").click(function() {
clicked = 1;
});
$("#lg-sq").click(function() {
clicked = 2;
});
$("#thumb").click(function() {
clicked = 3;
});
$("#small").click(function() {
clicked = 4;
});
$("#mid").click(function() {
clicked = 5;
});
$("#apagar").click(function() {
$("#results").html('');
});
$('#pesquisar').click(function() {
$("#results").html('');
$.ajax({
url: 'https://api.flickr.com/services/rest/?method=flickr.photos.search',
dataType: 'xml',
data: {
api_key: '2fd41b49fedfd589dc265350521ab539',
tags: $("#tag").val(),
format: 'rest'
},
success: sucessHandler,
error: errorHandler …Run Code Online (Sandbox Code Playgroud)