Hi,
What's the best practice for using ASP.NET expressions inside an external Javascript file?
I'm using the ASP.NET MVC framework currently and need to do something similar to the following from within an external JS reference:
jQuery(document).ready (function () {
jQuery ("#element<%= Model.IdFromAThing %>").click (... blah ...
...
I have an asp.net web application using the ReportViewer2008-SP1 controls to display some reports from the SSRS ReportServer. On some of the reports, i am seeing a JS error - "tNode is null or not an object". I am not sure if this has anything to do with the problem, but these reports have the tablix control being used in them. the erro...
I am building an HTML Gui builder and this involves round-tripping HTML pages from the browser to the server and back again.
On the back-end I have an xml parser which expects well-formed tags.
I kick off by writting well-formed HTML - for example:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
...
I'm wondering if there's a way to create a breaking news div that can appear even if a file exists on the server and even if a dynamic page has been statically saved for caching purposes.
E.g. every page (dynamic/static) has an empty with an id:
<div id="breaking"></div>
Is there a way, as the page loads, to have ajax check if a fil...
As far as I know, what I ask here isn't possible, but I thought I'd ask anyway in case I'm missing something.
Suppose you want to let users upload JPG images, and these images are scaled into smaller icons and the original images are always discarded and never required again. Is there any way that would commonly work in most modern brow...
Hi,
when I run this JS in FF or Safari it works just right but in IE I get 'optionValue' is Null or not an Object.
$(function() {
$('#selectBrand').change(function(){
$.getJSON('Scripts/ajax_busquedas.php', {idMarca : $(this).val() }, function(j) {
var options = '';
var i = '';
for (i = 0; i < j.length; i++) ...
I am trying to clean up some of the JavaScript throughout my views and one of the things I would like to do is move my jQuery Validation code to an external script function and pass in references to the fields I need to process/validate. The issue I am facing is pertaining to how the signature of jQuery Validate's rules field is formatte...
Let's say I want to execute a PHP script. Which way is better?
This:
$.ajax({
type: "GET",
url: "php-script.php",
dataType: "script"
});
Or this:
$.get("php-script.php", function(data) { });
...
<script type="text/javascript">
function validate() {
if (document.form.price.value.trim() === "") {
alert("Please enter a price");
document.form.price.focus();
return false;
}
if (document.form.price.value !== "") {
if (! (/^\d*(?:\.\d{0,2})?$/.test(document.form.price.value))) {
a...
Hi,
I am using mootools to create a CSS skin for the Youtube chromeless player using the javascript API to control playback. I cannot post the code unfortunately. The question I have is a more general one. When using the slider plugin a call to mySlider.set(step) moves the knob to the correct step on the slider but it triggers all of th...
I have the following JavaScript function:
function Console() {
this.Log = function(msg) {
if (document.getElementById("console")) {
var console = document.getElementById("console");
console.innerHTML += msg + "<br/>";
}
}
}
Question 1:
Why do I need to use new key word?
new Console().Lo...
I modify document.getElementById('').innerHTML with Java Script in a page. It's working fine in Firefox, but not IE8. Please see below for more details:
HTML Code:
<table>
<tr id="abc">
<td id="ccc" style="color:red;">ccc</td>
</tr>
</table>
Java Script code:
document.getElementById('abc').innerHTML = '<td id="bbc" styl...
Hi,
I am programming an application using AJAX and facebook connect. The location of the application is http://dev.cafexi.com/fbconnect
I'm having what I think is a simple issue
1) when I load the site in any browser except for IE it loads instantaneously - so no issues there
2) When I load in ie 7 or ie 8 it load incredibly slow. ...
I have a sorted javascript array, and want to insert one more item into the array such the resulting array remains sorted. I could certainly implement a simple quicksort-style insertion function:
var array = [1,2,3,4,5,6,7,8,9];
var element = 3.5;
function insert(element, array) {
array.splice(locationOf(element, array)+1, 0, element...
I have a javascript function that I need to call inside my body tags. My javascript fuction looks like this:
function NewExistingPicture(pictureName) {
//code for javascript function
}
And this is what I'm trying to do in HTML:
Existing Photos:
<% foreach (var Photo in Model.ProductThumbnails)
{ %>
NewExistingPicture(<...
I have a div on the aspx page in which I have created an onClick event.
The onClick for the div points to:
onclick="'javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton", "", true, "", "", false, f...
Here's the relevant controller code:
if @song.update_attributes(params[:song])
respond_to do |format|
format.js {
render :action => 'success'
}
end
else
Here's what's in success.js.erb:
$("#song_updated_at").val( "<%= escape_javascript @song.updated_at %>" )
Here's the error I get:
ActionView::TemplateError ($_ v...
When I first started with Javascript, I usually just put whatever I needed into functions and called them when I needed them. That was then.
Now, as I am building more and more complex web applications with Javascript; taking advantage of its more responsive user interaction, I am realizing that I need to make my code more readable -...
I want to use jQuery to create a new div on the page when a certain link's click event is activated. I know this part will be fine. The part I am concerned about is this: if inside of the newly created div is another link, will I then be able to use jQuery to capture the click event of this new link? I.e. will the javascript be able to...
Is there/what is the maximum length of the query string when doing an AJAX GET request? More specifically, I am doing cross-domain AJAX using an image:
img = new Image();
img.src = "http://www.otherdomain.com/something.gif?long_query_string=long........";
What is the limit on the query string here?
...