当我点击导航按钮时,我正在使用jQuery来更改URL哈希.但是当我使用鼠标滚轮滚动时,URL不会改变.我怎样才能做到这一点?如何使用
window.history.pushState(“object or string”, “Title”, “/new-url”);
Run Code Online (Sandbox Code Playgroud)
我无法理解它.请帮我的javascript代码
$j(document).ready(function () {
$j("#start1").click(function (e) {
e.preventDefault();
var section = this.href,
sectionClean = section.substring(section.indexOf("#"));
$j("html, body").animate({
scrollTop: $j(sectionClean).offset().top
}, 1000, function () {
window.location.hash = sectionClean;
});
});
});
$j(document).ready(function () {
$j("#start2").click(function (e) {
e.preventDefault();
var section = this.href,
sectionClean = section.substring(section.indexOf("#"));
$j("html, body").animate({
scrollTop: $j(sectionClean).offset().top
}, 1000, function () {
window.location.hash = sectionClean;
});
});
});
Run Code Online (Sandbox Code Playgroud)
和HTML代码是
<a href="#home" id="start1"style="text-decoration:none;position:absolute;right:450px;top:37px;font-weight:bold;color:white;font-size:15px;z-index:200;transition:0.5s" onmouseover="big(this)" onmouseout="small(this)"><span >HOME</span></a>
<span><a href="#products" id="start2" style="text-decoration:none;position:absolute;right:250px;top:37px;font-weight:bold;color:white;font-size:15px;transition:0.5s" onmouseover="big(this)" onmouseout="small(this)">PRODUCTS & SERVICES</a></span>
Run Code Online (Sandbox Code Playgroud) 我正在使用ajax请求从客户端向服务器端发送值以使用ajax请求插入mysql数据库.价值是用印地语写的(हिन्दीमतलबजाने).但是在客户端,当我发出警报时,我得到了如上所示的印地文文本,但是在服务器端请求被处理之后,它被插入到数据库中%u0939%u093F%u0928%u094D%u0926%u0940 %u092E%u0924%...
我在客户端使用过
request1h[k].setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8;");
request1h[k].send(requestDatah);
Run Code Online (Sandbox Code Playgroud)
并在服务器端标题与PHP
<?php header("Content-Type: text/html; charset=utf-8");
mysqli_set_charset($con,"utf8");
Run Code Online (Sandbox Code Playgroud)
然后我读了关于utf8_encode并在post值上也使用了它
$value1 = utf8_decode($_POST['values']);
Run Code Online (Sandbox Code Playgroud)
但我仍然无法在数据库中插入印地文文本.请帮帮我怎么办?