我在浏览器中有一个查询字符串,例如$(document).ready(function(){
var calendar = $('#calendar').fullCalendar({
height: 650,
firstDay: 1,
buttonText: {
prev: "Ant",
next: "Sig",
today: "Hoy",
month: "Mes",
week: "Semana",
day: "Día",
},
monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'],
dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'],
dayNamesShort: ['Dom','Lun','Mar','Mié','Jue','Vie','Sáb'],
timeZone: 'local',
header:{
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaWeek',
minTime: '08:00:00',
maxTime: '21:00:00',
editable: true,
selectable: true,
allDaySlot: false,
events: "calendario.php?view=1", // request to load current events
eventClick: function(event, jsEvent, view) { // when some one click on any event
endtime = $.fullCalendar.moment(event.end).format('hh:mm');
starttime = $.fullCalendar.moment(event.start).format('dddd, MMMM Do YYYY, hh:mm');
var mywhen = starttime + ' - ' + endtime;
$('#creador').html("Creado por : "+event.usuario);
$('#modalTitle').html(event.title);
$('#modalWhen').text(mywhen);
$('#eventID').val(event.id);
$('#modalDescripcion').html(event.descripcion)
$('#calendarModal').modal();
},
select: function(start, end, jsEvent) { // click on empty time slot
endtime = $.fullCalendar.moment(end).format('hh:mm');
starttime = $.fullCalendar.moment(start).format('dddd, MMMM Do YYYY, hh:mm');
var mywhen = starttime + ' - ' + endtime;
start = moment(start).format();
end = moment(end).format();
$('#createEventModal #startTime').val(start);
$('#createEventModal #endTime').val(end);
$('#createEventModal #when').text(mywhen);
$('#createEventModal').modal('toggle');
},
eventDrop: function(event, delta){ // event drag and drop
$.ajax({
url: 'calendario.php',
data: 'action=update&title='+event.title+'&start='+moment(event.start).format()+'&end='+moment(event.end).format()+'&id='+event.id+'&descripcion'+event.descripcion+'&tipo='+event.tipo ,
type: "POST",
success: function(json) {
// console.log(json);
}
});
},
eventResize: function(event) { // resize to increase or decrease time of event
$.ajax({
url: 'calendario.php',
data: 'action=update&title='+event.title+'&start='+moment(event.start).format()+'&end='+moment(event.end).format()+'&id='+event.id,
type: "POST",
success: function(json) {
// alert(json);
}
});
}
});
$('#submitButton').on('click', function(e){ // add event submit
// We don't want this to act as a link so cancel the link action
e.preventDefault();
doSubmit(); // send to form submit function
});
$('#updateButton').on('click', function(e){ // add event submit
// We don't want this to act as a link so cancel the link action
e.preventDefault();
doUpdate(); // send to form submit function
});
$('#deleteButton').on('click', function(e){ // delete event clicked
// We don't want this to act as a link so cancel the link action
e.preventDefault();
doDelete(); //send data to delete function
});
function doDelete(){ // delete event
$("#calendarModal").modal('hide');
var eventID = $('#eventID').val();
$.ajax({
url: 'calendario.php',
data: 'action=delete&id='+eventID,
type: "POST",
success: function(json) {
if(json == 1)
$("#calendar").fullCalendar('removeEvents',eventID);
else
return false;
avisoscalendario()
}
});
}
function doUpdate(){ // delete event
$("#calendarModal").modal('hide');
var eventID = $('#eventID').val();
$.ajax({
url: 'calendario.php',
data: 'action=update&id='+eventID,
type: "POST",
success: function(json) {
$("#calendar").fullCalendar('renderEvent',
{
id: json.id,
title: title,
start: startTime,
end: endTime,
descripcion: descripcion,
tipo: tipo
},
true);
avisoscalendario()
}
});
}
function doSubmit(){ // add event
$("#createEventModal").modal('hide');
var title = $('#title').val();
var startTime = $('#startTime').val();
var endTime = $('#endTime').val();
var descripcion = $('#descripcion').val();
var tipo = $('#tipo').val();
$.ajax({
url: 'calendario.php',
data: 'action=add&title='+title+'&start='+startTime+'&end='+endTime+'&descripcion='+descripcion+'&color='+tipo,
type: "POST",
success: function(json) {
$('#title').val("");
$('#descripcion').val("");
$("#calendar").fullCalendar('renderEvent',
{
id: json.id,
title: title,
start: startTime,
end: endTime,
descripcion: descripcion,
color: tipo
},
true);
avisoscalendario()
}
});
}
});
。
我想将关键字保留在不区分大小写的查询中,即https://application.com/loader/?orderNumber=313Q&tracerId=PLM5689
和ORDERNUMBER=313Q
或
TrAcErid=PLM5689
和ordernumber=313Q
仍将以相同的方式工作。
到目前为止,我正在使用一种变通办法,方法是遍历tracerid=PLM5689
并基本上检查它是否与我的参数匹配。
params.keys
是否有更好的方法来处理这种查询或某种最佳实践来处理查询字符串。我希望我的应用程序中会需要很多。
尽管这可行,但感觉却像是一种拙劣的方式。 我碰到过几篇文章,建议查询字符串中的参数区分大小写,但我似乎并不太清楚。
RFC 3986:https://tools.ietf.org/html/rfc3986#section-6.2.3
和这个https://webmasters.stackexchange.com/questions/90339/why-are-urls-case-sensitive