Search Results

Search found 7418 results on 297 pages for 'argument passing'.

Page 52/297 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Passing Javascript value to PHP Variable using ajax

    - by shels
    I am trying to use a Flash detection script to assess whether Flash Plugin is enabled in the user browser so that a different page loads. The Flash detection script is as follows, using jquery 1.8.2 and jquery.jqplugin 1.0.2 <script type="text/javascript" src="jquery-1.8.2.min.js"></script> <script type="text/javascript" src="jquery.jqplugin.1.0.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#withflash").hide(); $("#noflash").hide(); if ($.browser.flash == true) $("#withflash").show (); else $("#noflash").show (); }); </script> <div id="withflash">Flash Supported</div> <div id="noflash">Flash Not Supported</div> I get the display that "Flash Supported" if Flash Plugin is present.. I need to capture the value whether flash plugin value is true in a php variable $hasFlashSupport as below: <?php echo " $hasFlashSupport"; exit; ?> I am aware that PHP is server based and Javascript is client based.. Hence Ajax would be a nice option to capture the javascript variable to my php variable. I am totally ignorant about Ajax syntax and how to achieve it. Request the experts here to help me out with the code on how this can be achieved... Thanking all of you in advance..

    Read the article

  • Integration test for H1 text failing when it should be passing (Rspec and Capybara)

    - by rebec
    Below you can see my test for what happens when a user tries to access the page to edit a profile photo that they don't own. I've used the same test on the NEW action, where it worked fine, but it surprised me by failing when I copied it down to the EDIT action tests. I've used save_and_open_page to test what Capybara's seeing (as you can see below); the resulting page definitely has an h1 with the specified text in it. No spelling errors, and case is all the same as in the test. I've tried using both have_css and have_selector. Both fail. I'm still learning Ruby, Rails, Rspec and especially Capybara (was using webrat previously and recently switched over), and wonder if I'm misconceiving of something that's making me expect this to pass when it doesn't. Any thoughts? Thanks! describe "EDIT" do let(:user) { FactoryGirl.create(:user) } let(:different_user) { FactoryGirl.create(:user) } let(:admin_user) { FactoryGirl.create(:user, role: "admin") } let(:profile_photo1) { FactoryGirl.create(:profile_photo, user: user) } subject { page } context "when signed in as any member" do before { login different_user visit edit_user_profile_photo_path(:id => profile_photo1, :user_id => profile_photo1.user_id) save_and_open_page } # It should deny access with an Unauthorised/Forbidden message. it { should have_css('h1', text: "Unauthorised/Forbidden.") } end

    Read the article

  • "Passing Go" in a (python) date range

    - by anonymous coward
    The Rules: An employee accrues 8 hours of Paid Time Off on the day after each quarter. Quarters, specifically being: Jan 1 - Mar 31 Apr 1 - Jun 30 Jul 1 - Sep 30 Oct 1 - Dec 31 The Problem Employees will use an automated system to request paid time off, possibly occurring in the past, as well as the future. Requests should only be accepted if the employee has (or will have) that time available. For instance, if an employee only has 1 Day of Paid Time Off currently available (currently being January 20th), but is requesting 2 Days of Paid Time Off, beginning September 20th, the system should take into account that the employee would have accrued enough time off by then and allow the request. (Obviously ignoring that the employee may use up existing time before that date). I'm currently using Python, and wondering what the correct approach to something like this would be. I'm assuming that using DateTime objects, and possibly the dateutil module, would help here, but my brain isn't wrapping around this problem for some reason.

    Read the article

  • passing different structs to a function in c

    - by clear2k
    I have different structures that need to be filled out the same way. The only difference is that they are filled based on different data. I was wondering if it's possible to pass different structures to a certain function. What I have in mind is something like: struct stu1 { char *a; int b; }; struct stu2 { char *a; int b; }; static struct not_sure **some_func(struct not_sure *not_sure_here, original_content_list) { // do something and return passed struct for(i=0; i<size_of_original_content_list; i++){ //fill out passed structure } return the_struct; } int main(int argc, char *argv[]) { return_struct1 = some_func(stu1); return_struct2 = some_func(stu2); // do something separate with each return struct... } Any comments will be appreciate it.

    Read the article

  • JSON | Django passing python list

    - by MMRUser
    Hi, I'm trying to send a Python list in to client side (encoded as JSON), this is the code snippet which I have written: array_to_js = [vld_id, vld_error, False] array_to_js[2] = True jsonValidateReturn = simplejson.dumps(array_to_js) return HttpResponse(jsonValidateReturn, mimetype='application/json') So my question is how to access it form client side, can I access it like this: jsonValidateReturn[0] or how I assign a name to the returned JSON array in order to access it?

    Read the article

  • Passing class method as selector problem.

    - by Anoide
    Hi, I want to build a selector from a class method. I'm doing it this way: NavigationTreeActionHandler* handler=[NavigationTreeActionHandler self]; NavigationTreeNode* bombsNode=new NavigationTreeNode("Bombs","bigbomb.tif" ,handler,@selector(BigBombButtonPressed:)); I need to pass to NavigationTreeNode the target and the selector to the target method. I try to get the target using the self property of the class object (Don't know if htis is the correct way to do it). Then I get the selector for the class method I want to call on the class. Everything compiles ok but it fails when I use: [[handler class] instanceMethodSignatureForSelector:selector]; I get a nil and don't really know why... could anybody help please? Thanks in advance, Olson.

    Read the article

  • Passing data from one viewcontroller to another

    - by user1392515
    I subclassed two view controllers. The first one is supposed to pass data, a NSUrl object to the second one. .m of the first one: NSURL *temp = [NSURL URLWithString:@"http://example.com"]; UIViewController *presentationsFullScreen_ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PresentationsFullScreen_ViewController"]; presentationsFullScreen_ViewController.urlToUse = temp; .h of the second one: #import <UIKit/UIKit.h> @interface PresentationsFullScreen_ViewController : UIViewController { NSURL *urlToUse; } @property (nonatomic,retain) NSURL *urlToUse; It is obviously not working and not compiling,telling me essentially that I didn't subclass it and that the property urlToUse is not found on UIViewController. How do I subclass correctly? Thanks!

    Read the article

  • Javscript passing and using that function

    - by Totty
    I have: var f1 = function(a){ alert(a) } var f2 = function(data, method){ method(data) // the problem is here, // the method f1 is not called. Is there a way to call that method f1? // the method f1 might not be in this scope, the method f1 can // be in a class or like this... } f2(a, f1) The question is: Is there a way to call that f1 from f2, from the passed method? thanks

    Read the article

  • Passing partial arguments in tcshell

    - by R S
    Hey, I'm writing a shell script (tcsh) that is supposed to received 3 parameters or more. The first 3 are to be passed to a program, and the rest are supposed to be passed to another program. All in all the script should look something like: ./first_program $1 $2 $3 ./second program [fourth or more] The problem is that I don't know how to do the latter - pass all parameters that are after the third.

    Read the article

  • Using `g_object_set_data` for passing user name.

    - by PP
    I am using g_object_set_data to set user name with event_box so in call back i can get it with in event_box pointer. g_object_set_data(G_OBJECT(event_box), "user_name", (gpointer)(user_name) ); but problem is that i am setting user_name which is not an pointer allocated string. It is an local string (not allocated on hip) which gets destroyed. So is it necessary to allocated and then use the pointer, i just want to associate one name with this event_box.

    Read the article

  • Passing values between pages in JavaScript

    - by buni
    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Text; using System.Web.Services; using System.IO; namespace T_Smade { public partial class ConferenceManagement : System.Web.UI.Page { volatile int i = 0; protected void Page_Load(object sender, EventArgs e) { GetSessionList(); } public void GetSessionList() { string secondResult = ""; string userName = ""; try { if (HttpContext.Current.User.Identity.IsAuthenticated) { userName = HttpContext.Current.User.Identity.Name; } SqlConnection thisConnection = new SqlConnection(@"data Source=ZOLA-PC;AttachDbFilename=D:\2\5.Devp\my DB\ASPNETDB.MDF;Integrated Security=True"); thisConnection.Open(); SqlCommand secondCommand = thisConnection.CreateCommand(); secondCommand.CommandText = "SELECT myApp_Session.session_id FROM myApp_Session, myApp_Role_in_Session where myApp_Role_in_Session.user_name='" + userName + "' and myApp_Role_in_Session.session_id=myApp_Session.session_id"; SqlDataReader secondReader = secondCommand.ExecuteReader(); while (secondReader.Read()) { secondResult = secondResult + secondReader["session_id"].ToString() + ";"; } secondReader.Close(); SqlCommand thisCommand = thisConnection.CreateCommand(); thisCommand.CommandText = "SELECT * FROM myApp_Session;"; SqlDataReader thisReader = thisCommand.ExecuteReader(); while (thisReader.Read()) { test.Controls.Add(GetLabel(thisReader["session_id"].ToString(), thisReader["session_name"].ToString())); string[] compare = secondResult.Split(';'); foreach (string word in compare) { if (word == thisReader["session_id"].ToString()) { test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session")); } } } thisReader.Close(); thisConnection.Close(); } catch (SqlException ex) { } } private Button GetButton(string id, string name) { Button b = new Button(); b.Text = name; b.ID = "Button_" + id + i; b.Command += new CommandEventHandler(Button_Click); b.CommandArgument = id; i++; return b; } private Label GetLabel(string id, string name) { Label tb = new Label(); tb.Text = name; tb.ID = id; return tb; } protected void Button_Click(object sender, CommandEventArgs e) { Response.Redirect("EnterSession.aspx?session=" + e.CommandArgument.ToString()); } } I have this code when a user clicks a button www.mypage/EnterSession.aspx?session=session_name in the EnterSession.aspx i have used the code below to track the current URL _gaq.push(['pageTrackerTime._trackEvent', 'Category', 'Action', document.location.href, roundleaveSiteEnd]); Now I would also like to track in the Action parameter the session_name from the previous page.see the code below from the previous page test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session")); Some idea how to do it? Thanx

    Read the article

  • Passing javascript to a function

    - by AJ
    Hello, Can I pass some Javascript to a function and then execute that Javascript from within the function, e.g. test("a = 1; b = 2; test2(a,b);"); function test(js) { // execute dynamically generated JS here. } Basically I have some code that is generated on the server and I want to pass that code to a JS function which when it has finished processing it executes the code passed as a parameter. This could also be useful for the parameter of setTimeout, then the code passed could be executed in the timeout event. Can this be done?

    Read the article

  • Passing html attribute value to the next script in php

    - by NewBiL
    I have three php scripts. main.php questions.php and values.php Here's the code main.php <html> <head> <title></title> </head> <body> <h1>Be Prepare for the battle</h1> <?php $strTitle = "Begin"; $strLink = "<a href = 'question.php?ques_id=1'>" . $strTitle ."</a>"; echo $strLink; ?> </body> </html> questions.php <?php require_once('../connect.php'); $quesSQL = mysql_query("SELECT * FROM `questions` WHERE `ques_id`=". $_GET["ques_id"]); if(!mysql_num_rows($quesSQL)>=1) { die('Complete.'); } $next = $_GET["ques_id"]; while($row = mysql_fetch_array($quesSQL)) { $id = $row['ques_id']; $strTitle = $row['ques_title']; echo "<li>". $strTitle ."</li><br/>"; } $optSQL = mysql_query("SELECT `options`,`values` FROM questions_options WHERE ".$id."= ques_id"); echo "<form action=\"values.php\" method=\"POST\">"; while($row = mysql_fetch_array($optSQL) ) { $strOptions = $row['options']; $strValues = $row['values']; echo "<input type =\"radio\" name =\"valueIn\" value=".$strValues." />". $strOptions ."<br/>"; } echo "</form>"; $strTitle = "<input type =\"submit\" value=\"Next\">"; $next = $next+1; $strLink = "<a href = 'values.php?ques_id=".$next."'>" . $strTitle ."</a>"; echo $strLink; mysql_close(); ?> and values.php <?php require_once('../connect.php'); $input = $_POST['valueIn']; $ansSQL = mysql_query("SELECT `answer` FROM questions WHERE 1-".$_GET["ques_id"]."= ques_id"); $marks = 0; if($input == $ansSQL) { $marks = $marks+1; } else { $marks = $marks+0; } echo $marks; ?> Now problem is i have to pass one value from second script(questions.php) to third script(values.php). And it is from the <form> section in radio button's name value "valueIn". But I can't do that. Because I'm sending another value ques_id with $strLink variable at the end of the second script. So how can i do that?

    Read the article

  • Passing C string reference to C#

    - by user336109
    c code extern "C" __declspec(dllexport) int export(LPCTSTR inputFile, string &msg) { msg = "haha" } c# code [DllImport("libXmlEncDll.dll")] public static extern int XmlDecrypt(StringBuilder inputFile, ref Stringbuilder newMsg) } I got an error when I try to retrieve the content of newMsg saying that I'm trying to write to a protected memory area. What is the best way to retrieve the string from c to c#. Thanks.

    Read the article

  • Mef, passing parameters to a module

    - by Flex_Addicted
    Hi guys, I'm studying MEF and I'm not able to resolve a problem. I have a main application, called MainMEF, and a simple module, called SimpleModule. This one consists of a single UserControl which is loaded dinamically. When MainMEF starts up, I would be able to pass to the module a reference to main application contained into MainMEF. How could I fix this? Thanks in advance.

    Read the article

  • PHP Variable Passing in Foreach on same page

    - by tooly228
    I've been struggling this for a while and I simply can't figure this out. Here is my code: <?php foreach($list as $id =>$name) { echo("<td style=\"vertical-align:middle;\"> <a href=\"item=$id#confirm\" role=\"button\" data-toggle=\"modal\"> Buy</a></td></tr>"); }?> <html> <div class="modal small hide fade" id="confirm" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true"> <a href="redeem.php?item=<?php echo $id; ?>"><button class="btn btn-danger"> Buy</button></a></div> The main issue here is that the $id from the foreeach is not the same as the $id in the div class link. Instead the link is the end value of the foreach list.

    Read the article

  • jQuery passing an array to an AJAX call

    - by Josh K
    I have an array: myarr = []; I'm filling it with some values: myarray['name'] = "Me!"; Now I want to transform that array into a set of Key = Value pairs. I though jQuery would do it automatically, but it doesn't seem to. $.ajax ({ type: "POST", dataType: "text", url: "myurl", data: myarr }); Is there a way to do this or something I'm doing wrong? I get no javascript errors, and no serverside errors other then no POST information at all.

    Read the article

  • Passing list of items from Controller/Model to a variable in javascript - autocomplete

    - by newbie_developer
    I've a method in a NamesModel which fetches all the names and returns a list of names: public static List<NamesModel> GetAllNames() { List<NamesModel> names = new List<NamesModel>(); // // code to fetch records // return names; } In my controller: public ActionResult Index() { NamesModel model = new NamesModel(); model.GetAllNames(); return View(model); } In the view, I've got a textbox: @Html.TextBox("search-name") Now in my javascript, I want to fetch all names into a variable either from a model (from method) or from controller, for example: <script type="text/javascript"> $(function () { var names = ........... $(document).ready(function () { $('#search-name').autocomplete({ source: names }); }); }); </script> If I use hardcoding then it works but I want to use the names stored in the db. Is it possible? hardcoding example: var names = ["abc", "xyz"];

    Read the article

  • [C++] Passing around objects to network packet handlers ?

    - by xeross
    Hey, I've been writing a networking server for a while now in C++ and have come to the stage to start looking for a way to properly and easily handle all packets. I am so far that I can figure out what kind of packet it is, but now I need to figure out how to get the needed data to the handler functions. I had the following in mind: Have a map of function pointers with the opcode as key and the function pointer as value Have all these functions have 2 arguments, packet and ObjectAccessor ObjectAccessor class contains various functions to fetch various items such as users and alike Perhaps pass the user's guid too so we can fetch it from the objectaccessor I'd like to know the various implementations others have come up with, so please comment on this idea and reply with your own implementations. Thanks, Xeross

    Read the article

  • JQuery .get() only passing first two data parameters in url

    - by The.Anti.9
    I have a $.get() call to a PHP page that takes 4 GET parameters. For some reason, despite giving the $.get() call all 4, it only passes the first two. When I look at the dev console in chrome, it shows the URL that gets called, and it only passes action and dbname. Heres the code: $.get('util/util.php', { action: 'start', dbname: db, url: starturl, crawldepth: depth }, function(data) { if (data == 'true') { status = 1; $('#0').append(starturl + "<ul></ul>"); $('#gobutton').hide(); $('#loading').show("slow"); while(status == 1) { setTimeout("update()",10000); } } else { show_error("Form data incomplete!"); } }); and heres the URL that I see in the developer console: http://localhost/pci/util/util.php?action=start&dbname=1hkxorr9ve1kuap2.db

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >