Search Results

Search found 15081 results on 604 pages for 'passing by reference'.

Page 72/604 | < Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >

  • Passing list of values to django view via jQuery ajax call

    - by finspin
    I'm trying to pass a list of numeric values (ids) from one web page to another with jQuery ajax call. I can't figure out how to pass and read all the values in the list. I can successfully post and read 1 value but not multiple values. Here is what I have so far: jQuery: var postUrl = "http://localhost:8000/ingredients/"; $('li').click(function(){ values = [1, 2]; $.ajax({ url: postUrl, type: 'POST', data: {'terid': values}, traditional: true, dataType: 'html', success: function(result){ $('#ingredients').append(result); } }); }); /ingredients/ view: def ingredients(request): if request.is_ajax(): ourid = request.POST.get('terid', False) ingredients = Ingredience.objects.filter(food__id__in=ourid) t = get_template('ingredients.html') html = t.render(Context({'ingredients': ingredients,})) return HttpResponse(html) else: html = '<p>This is not ajax</p>' return HttpResponse(html) With Firebug I can see that POST contains both ids but probably in the wrong format (terid=1&terid=2). So my ingredients view picks up only terid=2. What am I doing wrong? EDIT: To clarify, I need the ourid variable pass values [1, 2] to the filter in the ingredients view.

    Read the article

  • Microsoft SQL Server 2005 Function, passing list of start and end times

    - by Kevin
    I'd like to do had a dynamic number of one start/end time pairs passed to a function as an input parameter. The function would then use the list instead of just one start, and one end time in a select statement. CREATE FUNCTION [dbo].[GetData] ( @StartTime datetime, @EndTime datetime ) RETURNS int AS BEGIN SELECT @EndTime = CASE WHEN @EndTime > CURRENT_TIMESTAMP THEN CURRENT_TIMESTAMP ELSE @EndTime END DECLARE @TempStates TABLE (StartTime datetime NOT NULL , EndTime datetime NOT NULL , StateIdentity int NOT NULL ) INSERT INTO @TempStates SELECT StartTime , EndTime , StateIdentity FROM State WHERE StartTime <= @EndTime AND EndTime >= @StartTime RETURN 0 END

    Read the article

  • Passing dependent objects to a parent constructor in Scala

    - by Nick Johnson
    Suppose I have the following class heirarchy: class A() class B(a:A) class C(b:B) class BaseClass(b:B, c:C) Now I want to implement a subclass of BaseClass, which is given an instance of A, and constructs instances of B and C, which it passes to its superclass constructor. If I could use arbitrary expressions, I'd do something like this: b = new B(a) c = new C(b) super(b, c) Because the second argument to the parent constructor depends on the value of the first argument, though, I can't see any way to do this, without using a factory function, or a gratuitous hack, such as : class IntermediateSubclass(b:B) extends BaseClass(b, new C(b)) class RealSubclass(a:A) extends IntermediateSubclass(new B(a)) Is there clean way to do this?

    Read the article

  • Passing a variable from beggining to end - Paypal

    - by Phil Jackson
    Hi all, I'be been at this for days and i cant seem to figure it out. All i want to do is when subscribe button is pushed, a variable is send ( post get i dont care ) payment is completed and landed on the success page, with my variable! From what i can gather this should be able to do it: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="0000000"> <Input type="hidden" name="custom" value="<?php md5($code.microtime()); ?>"/> <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> Any help much appreciated ( and yes I've read paypal and sandbox documentation, just not that good at reading. )

    Read the article

  • passing variable to a batch file

    - by sushant
    i am calling a batch file for xcopy. i have the path of the file to b copied in variable a. my code is: dim shell,z z="for.bat " & a & " " & b & " " & c set shell=createobject("wscript.shell") shell.Run z, 1, true where for.bat is: for %%f in (%1,%2,%3) do xcopy %%f D:\shipment\ /e when 'a' has small path like D:\flexcube, it works. but if i put some big path, say: D:\flexcube1\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder it does not work. is their some length restriction on %1 type variables or is this some other problem? any help is really appreciated.

    Read the article

  • passing a scalar query result to coalesce

    - by Fakrudeen
    How can I pass the result from a scalar [single row, single value] query to coalesce? I am trying to pick the priority as (the biggest priority so far in the table) + 1. [0 if it is the first row.] create trigger priority_SuperRuleSamples before insert on SuperRuleSamples FOR EACH ROW SET NEW.Priority=coalesce(NEW.Priority, coalesce( select Priority from SuperRuleSamples order by Priority desc limit 1, -1 )+1 )

    Read the article

  • Trouble with Action<T1, T2> and passing multiple parameters

    - by dotnetdev
    Hi, I have this code: s(x => x.Open()); s is a method which calls one parameter, which is perfectly fine, like so: public void s(Action<p1> action) {} Ignoring the naming conventions, if I make the method like the below: public void s(Action<p1, p2> action) {} How do I pass in more than one parameter? Out of interest, is there any way to use the params keyword with Action<? Also, I am using C# 4.0 so I would be interested to see how it can help me in an way. Thanks

    Read the article

  • Array passing between classes, gone?

    - by Kenneth
    Hey guys . i have two classes, SelectionScreenTable & GraphView. In the SelectionScreenTable class .h, i declared a NSMutableArray called usagedatas NSMutableArray *usagedatas; } @property (nonatomic, retain) NSMutableArray *usagedatas; In the SelectionScreenTable class.m i remembered to @synthesize. Later on, while processing my methods, i did a NSLog(@"usagedatas count:%i",usagedatas.count); to check whether it has value and it returned 1. so yeah its good up to this point. And in the -(void) dealloc , i remembered to released it . [usagedatas release]; So now comes ME trying to use it in another class. In GraphView.m i imported the "SelectionScreenTable.h". in the -(void)viewDidLoad i did SelectionScreenTable *UD = [SelectionScreenTable alloc]; NSLog(@"GraphView UD.usagedataas.count = :%i",UD.usagedatas.count); it returned 0. Any idea guys?

    Read the article

  • Passing ViewModel for backbone.js from MVC3 Server-Side

    - by Roman
    In ASP.NET MVC there is Model, View and Controller. MODEL represents entities which are stored in database and essentially is all the data used in a application (for example, generated by EntityFramework, "DB First" approach). Not all data from model you want to show in the view (for example, hashs of passwords). So you create VIEW MODEL, each for every strongly-typed-razor-view you have in application. Like this: using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MyProject.ViewModels.SomeController.SomeAction { public class ViewModel { public ViewModel() { Entities1 = new List<ViewEntity1>(); Entities2 = new List<ViewEntity2>(); } public List<ViewEntity1> Entities1 { get; set; } public List<ViewEntity2> Entities2 { get; set; } } public class ViewEntity1 { //some properties from original DB-entity you want to show } public class ViewEntity2 { } } When you create complex client-side interfaces (I do), you use some pattern for javascript on client, MVC or MVVM (I know only these). So, with MVC on client you have another model (Backbone.Model for example), which is third model in application. It is a bit much. Why don`t we use the same ViewModel model on a client (in backbone.js or another framework)? Is there a way to transfer CS-coded model to JS-coded? Like in MVVM pattern, with knockout.js, when you can do like this: in SomeAction.cshtml: <div style="display: none;" id="view_model">@Json.Encode(Model)</div> after that in Javascript-code var ViewModel = ko.mapping.fromJSON($("#view_model").get(0).innerHTML); now you can extend your ViewModel with some actions, event handlers, etc: ko.utils.extend(ViewModel, { some_function: function () { //some code } }); So, we are not building the same view model on the client again, we are transferring existing view model from server. At least, data. But knockout.js is not suitable for me, you can`t build complex UI with it, it is just data-binding. I need something more structural, like backbone.js. The only way to build ViewModel for backbone.js I can see now is re-writing same ViewModel in JS from server with hands. Is there any ways to transfer it from server? To reuse the same viewmodel on server view and client view?

    Read the article

  • Passing dynamic parameters to a stored procedure in SQL Server 2008

    - by themhz
    I have this procedure that executes another procedure passed by a parameter and its parameters datefrom and dateto. CREATE procedure [dbo].[execute_proc] @procs varchar(200), @pdatefrom date, @pdateto date as exec @procs @datefrom=@pdatefrom,@dateto=@pdateto But I need to also pass the parameters dynamically without the need to edit them in the procedure. For example, what I am imagining is something like this CREATE procedure [dbo].[execute_proc] @procs varchar(200), @params varchar(max) as exec @procs @params where @params is a string like @param1=1,@param2='somethingelse' Is there a way to do this?

    Read the article

  • Another passing variable through function jQuery/JS problem...

    - by dallen
    Here's my code: function mouseOver(variable) { return function() { $(variable).fadeIn(100); }; } function mouseOut(variable) { return function() { $(variable).fadeOut(100); }; } function lawyer(var1, var2, var3, var4) { return function() { $(var1).bind('mouseenter', mouseOver(var2)).bind('mouseleave', mouseOut(var2)).click( function() { $(var1).unbind('mouseenter').unbind('mouseleave'); $(var1).removeClass('off').addClass('on'); $(var3).bind('mouseenter', mouseOver(var4)).bind('mouseleave', mouseOut(var4)); $(var3).removeClass('on').addClass('off'); $(var4).hide(); }); } } lawyer("#group", ".b", "#group2", ".l"); What would be the reason for this not working? It works in that it hides $(var4).hide();, but clicking on the object doesn't seem to do anything. It works if I take the code out of a function and just copy/paste it a few times and change the targets. I'm not seeing it... Any help would be appreciated!

    Read the article

  • Passing javascript form variables into jQuery function not working

    - by Chase
    I am trying to pass some JavaScript variables that I have assigned to form variables into a query string used by a jQuery plug in called fancybox. If I hard code in the string that I want lightbox works great, however I need it to pass some form values in there to make it work as desire. <script type="text/javascript"> $(document).ready(function(){ var item = document.itemFinder.item; var zip = document.itemFinder.zip; var radius = document.itemFinder.radius; var dataString = "item=" + item + "&zip=" + zip + "&radius=" + radius; $("#various3").fancybox({ ajax : { type : "POST", data : dataString}, 'scrolling' : 'auto', 'overlayOpacity' : '0' } ); }); </script> What am I doing wrong?

    Read the article

  • Passing a model into RedirectToAction()

    - by larryq
    I'm curious how this works. In MVC you can call View() and pass a model as a parameter, but RedirectToAction (one of its incarnations at least) takes a 'routeValues' object, which appears to be the closest match. If your model is passed in this parameter will that model type be available in the subsequent action method? Or are there caveats involved that might prevent accurate translation in some circumstances?

    Read the article

  • N3WB Question: passing objects in java?

    - by Adam Outler
    Hello, I am new at java. I am doing the following: Read from file, then put data into a variable. checkToken = lineToken.nextToken(); processlinetoken() } But then when I try to process it... public static void readFile(String fromFile) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(fromFile)); String line = null; while ((line=reader.readLine()) != null ) { if (line.length() >= 2) { StringTokenizer lineToken = new StringTokenizer (line); checkToken = lineToken.nextToken(); ...... But here's where I come into a problem. public static void processlinetoken() checkToken=lineToken.nextToken(); } it fails out. Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method nextToken() is undefined for the type String at testread.getEngineLoad(testread.java:243) at testread.readFile(testread.java:149) at testread.main(testread.java:119) so how do I get this to work? It seems to pass the variable, but nothing after the . works.

    Read the article

  • Passing arguments to scope_procedure in searchlogic

    - by Greg
    I'd like to use searchlogic's scope_procedure feature like so class MyModelObject < ActiveRecord::Base scope_procedure :my_scope_proc, lambda { |p1, p2| { :conditions => "p1 >= #{p1} AND p2 < #{p2}" }} end Then, I am doing the search: scope = MyModelObject.search(:my_scope_proc => true) scope.all The above code obviously doesn't work because I didn't pass p1 and p2 parameters to my named scope. I can't figure out how to pass parameters to the named scope.

    Read the article

  • passing text_field values in ajx on rails

    - by user163352
    I'm using <%= text_field 'person', 'one',:id => 'test', :onchange=>remote_function(:url=>{:action=>"update"}, :update=>"test") %> <div id="test"></div> Now I just want to send the value of text_field with :action i.e :url=>{:action=>"update(value_of_text_field_entered"} Don't want to use params[:person][:one]. Any suggestions?or how can I use <%= observe_field % to send the value with action?

    Read the article

  • mvc jquery passing form values after user presses "Accept" button

    - by gdubs
    So I have a form and a submit button that posts the form to an action. But I wanted to show a popup where the user can deny or accept an agreement. Here's my jquery $(document).ready((function () { var dialog = $('#confirmation-dialog').dialog({ autoOpen: false, width: 500, height: 600, resizable: false, modal: true, buttons: { "Accept": function () { $(this).dialog('close'); $.ajax({ type: 'POST', data: {__RequestVerificationToken: $("input[name=__RequestVerificationToken]").val()} }); }, "Cancel": function () { $(this).dialog('close'); } } }); $('#registration-submit').click(function (e) { var action = $(this.form); console.log(action); var form = $('form'); dialog.dialog("open"); return false; }); })); My problem with this is that it would post, but it would only send my AntiforgeryToken, and not the values of the form. But when it goes through the TryupdateModel it would go through for some reason but will not Save (cuz of the missing data that wasn't passed on the formcollection).

    Read the article

  • Error after passing variable from jquery to code in c#

    - by Moraru Viorel
    I try to pass variable from jquery to code c# but something is wrong. I have in js this code: <script type="text/javascript"> var mySerial = '12345'; var fooUrl = '@Url.Action("Foo", "Home")'; window.location.href = fooUrl + '?mySerial' + encodeURIComponent(mySerial); </script> in controller : [HttpPost] public ActionResult Foo(string mySerial) { return View(); } After execution I keep this url: http://localhost:2214/@Url.Action("Foo",%20"Home")?mySerial12345 and I don't understand where's the problem, can someone help me?

    Read the article

  • passing string to a AJAX/JSON function

    - by Mikey1980
    I’m having trouble getting a AJAX/JSON function to work correctly. I had this function grabbing value from a drop down box but now I want to use an anchor tag to set it's value. I thought it would be easy to just use the onClick event to pass string to the function I was using for the drop down box but it doesn’t do anything. I’m stumped! Here how I set it up: 1st I add an onClick event… <a href="<?php echo Settings::get('app.webroot'); ?>?view=schedule&action=questions" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('bre','','template/images/schedule/bre_f2.gif',1) onclick="assignCallType('testing')";> 2nd I check main.js.php function assignCallType(type) { alert(type); //just for debugging new Request.JSON({ url: "ajax.php", onSuccess: function(rtndata,txt){ if (rtndata['STATUS'] != 'OK') alert('Error assigning call type to call'); }, onFailure: function (xhr) { alert('Error assigning call type to call'); } }).get({ 'action': 'assignCallType', 'call_type': type }); } 3rd Ajax.php: the variable is back in PHP and values don’t get added to the db, but I also didn’t get the alert from main.js.php if ($_GET['action'] == "assignCallType") { if ($USER->isInsideSales()) { $call_type = $_GET['call_type']; $_SESSION['callinfo']->setCallType($call_type); $_SESSION['callinfo']->save($callid); echo json_encode(array('STATUS'=>'OK')); } else { echo json_encode(array('STATUS'=>'DENIED')); } } Any idea where I am going wrong. The only difference between this and the working drop down is how the function was called, I used onchange="assignCallType(this.value)".

    Read the article

  • Passing variables from SQL proceedure to PHP

    - by Sam Corbet
    I am trying to create an sql proceedure that will return the results back to the php page. I want to be able to call the procedure as follows from the php call procedure_name($var1) which will run this script: -- --------------------------------------------------------------------------------- -- pUIGetCliStmtGenFlag -- -- This procedure returns the status of the Trading Period: -- -- --------------------------------------------------------------------------------- drop procedure if exists pUIGetCliStmtGenFlag; delimiter // create procedure pUIGetCliStmtGenFlag( IN pTradingPeriodMonth DATE ) MODIFIES SQL DATA COMMENT 'Checks if the TP has been closed' begin SELECT trading_period_month, dt_end, amt_traded_system_ccy FROM ca_trading_period WHERE trading_period_month=$var1 -- If amt_traded_system_ccy is NULL give the TP an open status otherwise mark as closed IF amt_traded_system_ccy is NULL $tpstatus='open' ELSE $tpstatus='closed' end; // delimiter ; I then want to be able to use $tpstatus in the rest of the php script. I know this is simple but this is completely new to me and I cant find the correct method

    Read the article

  • Passing a variable to javascript via a link.

    - by Jon
    My website has a javascript variable (addselectedsubdivision) that loads a neighborhood name from a box on the left to a box on the right. I was hoping I could build a link and then us PHP to add the subdivision letter, neighborhood, and city so that when you click on the link it goes right to this page and loads the neighborhood name in the box on the right. However, I can't get the variable to pass to the new page. Any suggestions? Website: http://www.mlsfinder.com/va_rein/jonmcachran/index.cfm?primarySearchType=sold&searchType=subdivision&so=a&domain=www.jonsellsvb.com&subdivision_string=p Example link: <a href="http://www.mlsfinder.com/va_rein/jonmcachran/index.cfm?primarySearchType=sold&searchType=subdivision&so=a&domain=www.jonsellsvb.com&subdivision_string=$firstletter" onLoad="addselectedsubdivision($neighborhood||$city);" target="_blank">

    Read the article

  • Form submits but by passing the form validation when button.click is used

    - by Cuty Pie
    I am using form validation plugin as well as html5 attribute=recquired with input type=button or submit and fancybox.when button is clicked ,both validation proceedures work(notification of empty inputs appeare),but instead of this notification ,form is submitted. If I dont use button.click function but use simple submit.then validation works perfectly plugin==http://validatious.org/ javascript function $(document).ready(function() { $('#send').click(function() { $(this).attr("value", 'Applying...'); var id = getParam('ID'); $.ajax({ type:'POST', url:"send.php", data:{option:'catapply', tittle:$('#tittle').val(), aud:aud, con:con, adv:adv, mid:$('#mid').val(), aud2:aud, cid:$('#cid').val(), scid:$('#scname option[selected="saa"]').val(), gtt:$('input[name=gt]:radio:checked').val(), sr:$(":input").serialize() + '&aud=' + aud}, success:function(jd) { $('#' + id).fadeOut("fast", function() { $(this).before("<strong>Success! Your form has been submitted, thanks :)</strong>"); setTimeout("$.fancybox.close()", 1000); }); } }); }); }); AND Html is here <form id="form2" class="validate" style="display: none" > <input type='submit' value='Apply' id="send" class="sendaf validate_any" name="jobforming"/>

    Read the article

  • Passing a filepath to a R function?

    - by Philipp
    Hi everybody, I tried to pass a filepath to a function in R, but I failed =/ I hope someone here can help me. >heat <- function(filepath) { chicks <- read.table(file=filepath, dec=",", header=TRUE, sep="\t") ... } When I call the function, nothing happens... >heat("/home/.../file.txt") ... and "chicks" is not found >chicks Error: Object 'chicks' not found What is the correct way to pass a path to a function? Best wishes from Germany, Phil

    Read the article

< Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >