|
|
I have been using AngularJS for about a month and have put it into a project and i really like it. AngularJS is written using javascript so javascript is something you SHOULD know. The nice thing about AngularJS is that you can incorporate javascript and jQuery (as long as you have a reference to it). When in doubt i use javascript over Jquery. Sure Jquery is easier to use but native javascript is much faster.
|
|
|
|
|
Yeah you are right . Native javascript is much faster than jquery. Thank you
Please up vote if it helped you
Thanks And Regards
Sibeesh
|
|
|
|
|
Hello there,
I want to have a function that turns this :
http://examplesite.com/folders/images/myphoto.jpg
to this :
http:\/\/examplesite.com\/folders\/images\/myphoto.jpg
Can any of you help me with that? I'm not that good at JS but I need this : /
Thanks.
|
|
|
|
|
If all that you want is to replace a '/' with '\/' then I would recommend you look into the String.replace method you get with javascript.
function repl(url) {
return url.replace('/', '\/');
}
But since you mentioned you were trying to turn a URL into JSON I am thinking there is more to what you are asking. In which case I would recommend the following:
http://james.padolsey.com/javascript/parsing-urls-with-the-dom/[^]
|
|
|
|
|
|
var httpAddress = 'http://examplesite.com/folders/images/myphoto.jpg',
charToRemp = '/',
rempCharWith = '\\/';
function regexp_changeCharsTo(charIn, from, to) {
var regExpFrom = RegExp(from, 'g');
return charIn.replace(regExpFrom, to);
}
function arrMap_changeCharsTo(charIn, from, to) {
return charIn
.split('')
.map(function (chr) {
if (chr === from) {
return to;
}
return chr;
})
.join('');
}
function forIn_changeCharsTo(charIn, from, to) {
var fnString = '';
for (var cr in charIn) {
if (charIn[cr] === from) {
fnString += to;
} else {
fnString += charIn[cr];
}
}
return fnString;
}
var regexp_test = regexp_changeCharsTo(httpAddress, charToRemp, rempCharWith);
var arrMap_test = arrMap_changeCharsTo(httpAddress, charToRemp, rempCharWith);
var forIn_test = forIn_changeCharsTo(httpAddress, charToRemp, rempCharWith);
|
|
|
|
|
I have a form containing data and a file input fields,
I want to submit and validate this form using jquery and ajax through one script.
Below is my form:
<form id="datas" method="post" enctype="multipart/form-data">
<input type="text" name="firstName" value="" />
<input name="pic" type="file" />
<button>Submit</button>
</form>
Now I have this code to validate the data
$('#datas').validate({
rules: {
firstName:{
required: true,
minlength: 2,
maxlength: 100
}
},
messages: {
firstName: {
required: "Please Enter first name",
minlength: jQuery.format("Enter at least {0} characters"),
maxlength: jQuery.format("Enter atmost {0} characters"),
}
}
});
Then I have a seperate code that could submit the form
$("#datas").submit(function(){
var formData = new FormData($(this)[0]);
$.ajax({
url: sucess.php,
type: 'POST',
data: formData,
async: false,
success: function (data) {
alert(data)
},
cache: false,
contentType: false,
processData: false
});
});
**QUESTION:**
Please how can I combine these two scripts to validate the file and data fields and also submit to the success page.
|
|
|
|
|
Since you are using the jQuery validation plugin why not read and follow their documentation where it appears they have some answers to questions similar.
http://jqueryvalidation.org/validate[^]
|
|
|
|
|
Using above code are getting any error?
|
|
|
|
|
I just happen to be writing this at the moment, you can use it as a template or to simply get some ideas
.onClientClick = load_template; return false;
function load_template() {
var
txtFocus,
txtError,
m_secureToken,
m_template,
m_filePath;
var vFlag = true;
txtFocus = $('[id*="_txt_Focus_Field"]').val();
txtError = $('[id*="_txt_Error_Field"]').val();
m_secureToken = $('[id*="_txt_Secure_Token_Field"]').val();
m_template = $('[id*="_ddl_CE_FI_Template_Field"] option:selected').text();
m_filePath = $('[id*="_ddl_CE_FI_Template_Field"]').val();
if (m_filePath === '--') {
$('[id*="_ddl_CE_FI_Template_Field"]').css('background-color', txtError);
$('[id*="_img_CE_FI_Template_Error"]').css('display', 'inline-block');
vFlag = false;
}
else {
$('[id*="_ddl_CE_FI_Template_Field"]').css('background-color', txtFocus);
$('[id*="_img_CE_FI_Template_Error"]').css('display', 'none');
}
if (true === vFlag) {
var send_Data =
"{" +
"\"p_secureToken\" : \"" + m_secureToken + "\", " +
"\"p_template\" : \"" + escape(m_template) + "\", " +
"\"p_filePath\" : \"" + escape(m_filePath) + "\" " +
"}";
alert(send_Data);
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "broadcastEditor.asmx/preview_Template",
data: send_Data,
dataType: "json",
error: function (xhr, status, error) {
exitCode = 2;
$('[id*="_updateProgress_Unified"]').fadeOut('fast', function () {
alert(xhr.responseText);
});
},
success: function (responseText) {
var objB = jQuery.parseJSON(responseText.d);
exitCode = objB.exitCode;
var p_Stream = unescape(objB.p_Stream.replace(/\+/g, " "));
$('[id*="_panel_CE_Container_XHTML"]').append(p_Stream);
$('[id*="_updateProgress_Unified"]').fadeOut('fast');
$('[id*="_panel_CE_Container_XHTML"]').fadeIn('normal');
}
});
}
}
|
|
|
|
|
Can you take a look at this http://imgur.com/JdKLgkR,gbRUpjS,P9dV4Za#0
Now,how to write a script from the above example?
And please don't mention google CSE,Chrome personal-blocklist,I have already tried them.
Thank you
modified 30-Aug-14 9:03am.
|
|
|
|
|
If you are asking how to hack people's systems you will get no assistance on this site. If you have a proper programming question, then please edit your post above and provide the details.
|
|
|
|
|
I want to exclude torrent sites from Google,cause family members(kids) trying to find torrent sites.I got a warning letter from ISP.
|
|
|
|
|
Rather than trying to modify their search results, why not try changing the settings on the router to restrict their access? Turn off UPnP and block all outbound ports except 21 (FTP), 80 (HTTP) and 443 (HTTPS).
If it still doesn't work, take their computers away until they learn to follow your rules.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Also have a look at the filtering the search results through Google options settings[^]
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
|
My requirement is, to focus fancy box pop up as soon as it pops out, and block other opened windows, till the user clicks on it.
Plz help...!!274
Thanks in advance.
|
|
|
|
|
Where are you stuck? What does you code look like?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
A quick google search for their site then shows there is a modal setting. http://fancybox.net/api[^]
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Have you written any code for that? if yes then pls share with us else first start doing it and then ask for help if u really got stucked.
|
|
|
|
|
Why don't you share your code if you tried anything? Or search in Google.
|
|
|
|
|
I am looking over some code that someone else wrote for three.js
The main.js file starts out with this.
var APP = {};
(function () {
"use strict";
/*global VT,THREE,Detector,requestAnimationFrame*/
/*jslint browser: true*/
/***************************************************************************
* Global Variables
*/
// three.js variables
var scene = null;
var renderer = null;
var camera = null;
var controls = null;
var mesh = null;
var clock = new THREE.Clock();
var domContainer = null;
var virtualTexture = null;
/***************************************************************************
* Initialiaze application
*/
function resize() {
renderer.setSize(window.innerWidth, window.innerHeight);
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
}
.
.
.
APP.load = function (geometry, config) {
// create virtual texture
geometry.computeTangents();
geometry.computeVertexNormals();
virtualTexture = new THREE.VirtualTexture(renderer.context, config);
var material = THREE.createVirtualTextureMaterial(virtualTexture);
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
THREE.duplicateGeometryForVirtualTexturing(geometry, virtualTexture);
};
}());
and the code ends like above.
I dont get this line (function () {
How does that work or even get called?
The code actually works and not seeing anything like this before
just made me curious.
Hope someone can shed some light on this.
Thanks,
Bob
|
|
|
|
|
All of the code is encapsulated inside an anonymous function that starts with the
(function () { line and ends with
}());
The function is executed straight away - the () on the last line calls it with no arguments. The only variable that this script exposes is "APP", which is an object containing the "load" function (and anything else that was added in the ... part).
|
|
|
|
|