Server Side OR Client Side

I have been working on a project, where I'm making AJAX call to load 100's of record from database, which would then be rendered on a slider. To be precise, the data I would be fetching is the 'Image Path' for all the images, and other details such as 'the size of slider thumbnail', 'number of thumbnails to show', etc. For this list of data, I have 2 options: 1

服务器端或客户端

我一直在做一个项目,我正在做一个AJAX调用,从数据库中加载100条记录,然后在一个滑块上呈现它。 准确地说,我要获取的数据是所有图像的“图像路径”,以及其他详细信息,例如“滑块缩略图大小”,“要显示的缩略图数量”等。 对于这个数据列表,我有两个选择:1.在服务器端生成HTML并将其发送到客户端,在那里将其应用到滑块。 2.生成并发送json数据给客户端。 解析这个json数据并生成Slider的Slides。 我很困惑使用哪种方法

jquery, find div class name at a certain position while scrolling

A fixed div ( fixed_div ) stays at the top to display a Google map inside it. Then a big div ( big_div ) stays beneath it. The big div has inside it many small divs with class small_div . Each small div has an id small_div_n where n=0,1,2,3.. consecutively. The big div is scrolled beneath the fixed div. HTML: <div class="fixed_div" > </div><!-- end of class fixed_div -->

jquery,在滚动时在某个位置找到div类名

固定div( fixed_div )停留在顶部以在其中显示Google地图。 然后一个大div( big_div )停留在它下面。 大div里面有许多small_div类的小div。 每个小small_div_n都有一个id small_div_n ,其中n = 0,1,2,3 ..连续。 大div在固定div下滚动。 HTML: <div class="fixed_div" > </div><!-- end of class fixed_div --> <div class="big_div"> <div class="small_div" id="small_div_0">

Json or html?

i have an asp.net mvc view that with the help of jquery ajax updates a div. Should i use a controller that return a PartialView or json? And the performances? If you want the user be able to switch between different views, and this is data that can simply be included on page load, then just include onload then hide/show or load as json and then populate as needed. If this is a very simple r

JSON或HTML?

我有一个asp.net mvc视图,在jquery ajax的帮助下更新div。 我应该使用返回PartialView还是json的控制器? 和表演? 如果您希望用户能够在不同视图之间切换,并且这些数据可以简单地包含在页面加载中,那么只需包含onload,然后隐藏/显示或加载为json,然后根据需要填充。 如果这是一个非常简单的请求,需要根据需要进行更新,并且您不需要计划其他类似的需求,那么只需返回html。 但是,如果你正在提交一个提交数据或者

Jquery AJAX return raw data or ready

This question already has an answer here: Why is it a bad practice to return generated HTML instead of JSON? Or is it? 13 answers I have certainly seen it done both ways. Here are some "bright-line rule" suggestions that you might consider. (1) If the content is going to be treated by the app as "a black box" ... "don't look at, we're not going to have to

Jquery AJAX返回原始数据或准备好

这个问题在这里已经有了答案: 为什么返回生成的HTML而不是JSON是一种糟糕的做法? 或者是? 13个答案 我确实已经看到它在两个方面都完成了。 以下是您可能会考虑的一些“明朗规则”建议。 (1)如果内容将被应用程序视为“黑匣子”......“不要看,我们不需要与它互动,我们需要做的就是显示它,不管它是什么“......然后让服务器为你做所有的工作可能是完全合适的。 (特别是如果有很多可能性,并且“服务器会最好的了解”,

Javascript Google Analytics authentication problems

I want to track Google Analytics data in my Dashboard but I want a server-side authentication not a client side. I found this login and tried to track my Data but it does not work really well... Usually I used something like this: gapi.analytics.auth.authorize({ clientId: 'XXXXXX', container: 'auth-button' }); var viewSelector = new gapi.analytics.ViewSelector({ container: 'view-se

Javascript Google Analytics身份验证问题

我想在我的控制台中跟踪Google Analytics数据,但我需要服务器端身份验证而不是客户端。 我发现这个登录信息,并试图追踪我的数据,但它不能很好地工作...通常我使用这样的东西: gapi.analytics.auth.authorize({ clientId: 'XXXXXX', container: 'auth-button' }); var viewSelector = new gapi.analytics.ViewSelector({ container: 'view-selector-container' }); viewSelector.execute(); var dataChart = n

Track and redirect an offsite link using Google Analytics without javascript?

I have a text file link which needs to be tracked for geo profile of my users, is it possible to have a url which will redirect my users to the correct file and record the stats in Google Analytics without using javascript. For clarity I need something like http://www.google-analytics.com/__utm.gif?utmwv=5.1.7&utms=1&utmn=1894752493&utmhn=www.mylink.com&utmcs=UTF-8&utmsr=1280

使用没有javascript的Google Analytics跟踪和重定向非现场链接?

我有一个文本文件链接,需要跟踪我的用户的地理位置配置文件,是否有可能会将我的用户重定向到正确的文件并在Google Analytics中记录统计信息而不使用JavaScript。 为了清楚起见,我需要诸如http://www.google-analytics.com/__utm.gif?utmwv=5.1.7&utms=1&utmn=1894752493&utmhn=www.mylink.com&utmcs=UTF-8&utmsr=1280×1024&utmsc=24-bit但需要重定向到目标页面。 我不能使用任何服务器端脚本,因

Change an element's class with JavaScript

如何使用JavaScript更改一个HTML元素的类以响应onClick事件? Modern HTML5 Techniques for changing classes Modern browsers have added classList which provides methods to make it easier to manipulate classes without needing a library: document.getElementById("MyElement").classList.add('MyClass'); document.getElementById("MyElement").classList.remove('MyClass'); if ( document.getElementById("MyEle

使用JavaScript更改元素的类

如何使用JavaScript更改一个HTML元素的类以响应onClick事件? 用于改变类的现代HTML5技术 现代浏览器已经添加了classList ,它提供了一些方法,使得在不需要库的情况下操作类变得更容易: document.getElementById("MyElement").classList.add('MyClass'); document.getElementById("MyElement").classList.remove('MyClass'); if ( document.getElementById("MyElement").classList.contains('MyClass') ) document.getEle

the thin line between web apps and desktop apps

I've been working a lot lately with web apps, mostly with javascript and json-rich web UIs. I have to say I get impressed all the time with what I can achieve through these technologies. More and more, I ask myself whether I would have preferred to go with a classic GUI to start with (whether it was C#/VB.Net + WinForms, or C/C++ + GTK/QT or Java or anything). I, however, have been able t

Web应用程序和桌面应用程序之间的细线

最近我一直在使用网络应用程序工作,主要是使用javascript和json丰富的Web UI。 我不得不说我始终对我通过这些技术所取得的成就印象深刻。 越来越多的问题是,我是否会喜欢使用经典的GUI开始(无论是C#/ VB.Net + WinForms还是C / C ++ + GTK / QT或Java或其他)。 但是,我已经能够完成我想要的所有与Web相关的技术的用户界面。 尽管我觉得自己拥有了我所需要的一切,但越来越多的东西不断涌入(并且会一直持续到来),

Log in authentication using Jquery and Json

Currently I have a login form that will send JSON data (username and password) to my api server and the server will send back JSON data (username and balance) back to my webpage. My HTML Code: <input type="text" name="username" id="username" class="text" maxlength="30" /> <br /> <input type="password" name="password" id="password" class="text" maxlength="30" /> <br /> &

使用Jquery和Json登录认证

目前我有一个登录表单,它会将JSON数据(用户名和密码)发送到我的api服务器,服务器会将JSON数据(用户名和余额)发送回我的网页。 我的HTML代码: <input type="text" name="username" id="username" class="text" maxlength="30" /> <br /> <input type="password" name="password" id="password" class="text" maxlength="30" /> <br /> <input type="submit" name="btnSubmit" id="btnSubmit"

Convert Javascript string or array into JSON object

I have a JavaScript variable with comma separated string values - ie value1,value2,value3, ......,valueX, I need to convert this variable's values into a JSON object. I will then use this object to match user enteredText value by using filterObj.hasOwnProperty(search) Please help me to sort this out. What you seem to want is to build, from your string, a JavaScript object that would ac

将JavaScript字符串或数组转换为JSON对象

我有一个JavaScript变量,用逗号分隔字符串值 - 即value1,value2,value3, ......,valueX, 我需要将此变量的值转换为JSON对象。 然后,我将使用此对象通过使用filterObj.hasOwnProperty(search)来匹配用户输入的文本值 请帮我解决这个问题。 你似乎想要的是从你的字符串中构建一个JavaScript对象,这个对象可以作为一个地图,这样你就可以高效地测试内部的值。 你可以这样做: var str = 'value1,value2,value3,valueX';